Summon 2.0 customised searchbox


I have spent the better part of the morning crafting a search box that accommodates the customisations we had in place for Summon 1.0 that could not be accommodated by the script method generated using Summon’s widget/box builder.
Curiously I also found that if we used the “exclude” newspaper option then the whole search box disappeared from our home page. This seems to be some idiosyncrasy of the script and our CMS/web page structures as it worked fine when I embedded the same script in a blog post for testing.
Our 1.0 search box had radio buttons for users to limit their search to books & ebooks or journal articles or video recordings. The 2.0 search box builder does not make this possible. We also had some additional content type limiters built into it that are not part of the standard box builder.
Goals:
  1. Radio options to enable users to select the scope of their search: All, Books/eBooks, journal articles, video recordings
  2. Hidden input to make newspaper articles, book reviews and trade publications excluded from a standard search. Users can turn off those limits from the results page if they wish.
On this Summon documentation page, the example shows that the input text field should use name=”q”. This worked fine until I added in the content type input fields.
Then I read Matthew Reidsma’s work notes on this topic and saw this key piece of information.
“When reading the current Serials Solution documentation for scoped searches, I saw that even 1.0 boxes were supposed to be created differently than ours. I suspect we had an old syntax (routing to/search/results instead of /search) and the name parameter for our forms was just “q” instead of “s.q”. Interestingly the documentation says that 2.0 has simplified the fields to just “q” but in my tests this caused the results screen to be blank almost every time. Switching it back to “s.q” worked.”
As soon as I changed it to name=”s.q” the whole form just worked.
This is the code we are using on our home page as I write this.

<form action="http://bond.summon.serialssolutions.com/" method="get" id="summon" class="mainsearch">
  <p>
  <input id="query" name="s.q" type="text" placeholder="Search resources" data-inline="true"/>
  <input id="keyword-submit" value="Search" data-inline="true" data-mini="true" type="submit"/>
  </p>
  <p>
    <input checked="checked" id="fvf_contenttype,all" value="" name="" type="radio" />
    <label for="fvf_contenttype,all">All</label>
    <input id="fvf_contenttype,book" value="addFacetValueFilters(ContentType,Book / eBook)" name="s.cmd" type="radio" />
    <label for="fvf_contenttype,book">Books & eBooks</label>
    <input id="fvf_contenttype,article" value="addFacetValueFilters(ContentType,Journal Article)" name="s.cmd" type="radio" />        
    <label for="fvf_contenttype,article" >Journal articles</label>
    <input id="fvf_contenttype,electronic resource" value="addFacetValueFilters(ContentType,Video Recording)" name="s.cmd" type="radio" />
    <label for="fvf_contenttype,Video Recording" >Videos</label>
  </p>
 
   <input type="hidden" name="s.cmd" id="fvf_contentType,exclusions" value="addFacetValueFilters(ContentType,Newspaper Article,t|ContentType,Book Review,t|ContentType,Trade Publication,t)" />


</form>