Emulating III’s Advance Keyword Searching using Z39.50

By reeset / On / In Digital Libraries, Programming

Its funny how things work.  I was talking today with David Walker about III and their Z39.50 implementation.  The problem that David had noticed and had asked me about was whether I had noticed that the items being returned via the Z39.50 keyword search were different than a query done via the Opac.  Up until now — I hadn’t seen any differences.  Then, speak of the devil, a sample query of “forest service technical notes” was done within our homegrown metasearch tool.  Using III’s default Z39.50 settings, this query will return zero hits in our system because III queries the items as a phrase.  However, when I run this query in the Opac, I receive 4 results.  So the question was how to retrieve the same results….

The solution was actually a simple one and comes down to understanding how III is doing its queries.  If you look at the III manual, you get an idea.  III notes that when the advance keyword option is enabled on the system, the advanced indexes can be utilized when doing a title, author but not a keyword search.  This is because of how III’s keyword search is done.  By default, unless the terms are enclosed in quotes, the search is automatically done as an and’d search.  So for example, in my test search, III is actually running the search “forest service technical notes” as: forest and service and technical and notes.  If the result returns zero hits, III has an option to automatically do the search again as an or search: forest or service or technical or notes.  Ideally, we wouldn’t want the or’d functionality — but the former — that is desireable, since we want users to get the same results from our metasearch tool as they would get from the Opac.  So the solution is simple.   When the query comes to the system, the query is examined for boolean markers and grouping (quotes) elements.  If these elements are not present, then the search is broken down so that each keyword is and’d.  Once I made the modification, every phrase search run against our metasearch tool and then against our Opac where exactly the same (save that our results provided better ranking :D).