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.
- Radio options to enable users to select the scope of their search: All, Books/eBooks, journal articles, video recordings
- 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.
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 toAs soon as I changed it to name=”s.q” the whole form just worked.
/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.”
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">
<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"/>
<input checked="checked" id="fvf_contenttype,all" value="" name="" type="radio" />
<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>
<input type="hidden" name="s.cmd" id="fvf_contentType,exclusions" value="addFacetValueFilters(ContentType,Newspaper Article,t|ContentType,Book Review,t|ContentType,Trade Publication,t)" />