Summon has a really cool new custom search box building widget that includes the ability to pre-limit a search to a specific discipline (or disciplines). The widget also allows you to pre-select which facets to apply to the search.
A question came up on the SummonClients mailing list asking if it was possible to exclude facets from the search — “[is there] a way to exclude newspapers AND book reviews (AND possibly Dissertations) from the initial search”? There isn’t an obvious way at the moment to do that, but I’m a shambrarian and I like to tweak and tinker with things 😀
So, to exclude a content type facet…
1) Go into the Search Box Builder widget and expand the Content Type selection:
2) Select any Content Types to you want to exclude (e.g. Book Review, Dissertation/Thesis and Newspaper Article):
3) Make any other changes you want (appearance, other facets, etc) and click on Get Code to get the widget’s HTML:
At this point, we’ve got a search widget that will only find results that are Book Reviews, Dissertation/Thesis (Thesii? Thesissesses?) or Newspaper Articles. So, the final change to make is to tweak the HTML so that those 3 types are excluded, which you can do by adding a ,t to each of them:
...["ContentType,Dissertation,t", "ContentType,Book Review,t", "ContentType,Newspaper Article,t"]...
The result should be a custom search box that excludes the chosen content types:
4 thoughts on “Tweaking the Summon Search Widget code”
Tried it. Looks good. It seems you can also mix and match includes and excludes to content types so you can include journal articles and also exclude newspapers.
I am not sure if there is any point in having both include and exclude content types. Can one item have more than one content type?
I think an item only has one content type — so book reviews that appear in a journal should be in Summon as a “Book Review” rather than “Journal Article”.
As far as I can tell, it’s not possible to do the same “,t” trick with subject terms.
Yes, I remember reading somewhere (in the support center?), each item has only one content type, but now I can’t find it?
Though I did find a note about facet counts and results count differing due to merging duplicate records with multiple content types .
e.g primates suriname on my system leads to a higher count if i add up the content type facet counts as opposed to the search results shown.
Does that mean I have items that are in multiple content types at least at facet level? Is mentioned in the support center but I suppose it’s very rare to be worth worrying about.
Quite surprised the same trick doesn’t work with subject terms…will play with that.
This is fantastic, as usual, Dave. Thanks!
Comments are closed.