This enhancement will add a Boolean search tab to advanced search, which, when accessed, will allow users to enter a free-form Boolean search query using traditional Boolean operators (and, or, not). Evergreen locale settings are also leveraged to provide support for operators in other languages.
This functionality was important to many of our libraries because, even
though the advanced search interface provides graphical support for
Boolean searches, there is no way to control the nesting of searches,
making it difficult to perform more complex searches.
For example, if a user were to enter the search terms in Advanced Search
as drugs AND teenagers OR adolescents, the resulting query would be
((drugs && keyword:teenagers) || keyword:adolescents), when the intended
query is drugs && (teenagers || adolescents). Performing a search with
more complex nesting, something like "((mouse or rat) and trap) or
mousetrap", requires free-form entry to get the nesting right. However,
users are expected to know that && means "and" and that || means "or."
Our academics, in particular, were concerned, because they often start
their instruction in Boolean searching with the library catalog before
moving on to full-text databases.
A setting is available in config.tt2 to enable/disable this feature and to identify limiters that appear on the Boolean tab.
Still to come is support for wrapping an operator in quotation marks to treat it as a search term to allow for searches like:
"pride and prejudice" and (vampires or zombies)
where the first "and" is part of the quoted search term and the second "and" is converted to &&.
Catalyst IT did the work. The branch is available at:
http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/catalystit/boolean_search
I'll add a pullrequest tag once MassLNC has done some initial testing, but I wanted to post the code early on so that the community has an opportunity to review it too.
After a quick read of the code, _prepare_ biblio_ search_ boolean( ) concerns me; it's globbing and parsing files on disk for each and every search? Typically that would happen once, at startup time, and the results would be cached thereafter.
The location of the boolean localization files in the "/location/" directory seems a bit strange. Is that a placeholder for a better name?
Also, if I understand correctly, searching for "To be or not to be" is no longer going to result in highly relevant results for that phrase (as just a quick example that comes to mind). That concerns me, too, as a major change in behaviour.