[Koha] Koha Digest, Vol 80, Issue 38
jcamins at cpbibliography.com
Tue Jun 26 06:18:39 NZST 2012
How is it that no one has added this kind of searching to the community
> version of Koha? It's a major omission.
I think it's a matter of funding and interest. A lot of developers would
love to see better search lexing in Koha, but the cost would be rather
high, as it requires a more-or-less complete rewrite of the searching code
in order to work, and my impression is that the searching works well enough
for most people that it just isn't a priority for most organizations
funding Koha development. That said, I am in complete agreement that not
having a flexible search lexer in Koha is a serious omission.
People are so used to using quote marks and those operators in search
> strings that they often try to use them in Koha even though they don't work
> as expected. One of the features in an "easy to use" OPAC is that the
> searching conforms to expected norms that the public knows from other
> common search interfaces.
I'm astonished that no one in the world has added properly working code
> that would make the most widely understood phrase searching method
> (quotation marks) available in community Koha.
Quotation marks for identifying longer strings in searches do work,
actually, though not quite the way we might like. What we (as librarians)
call a phrase search is (sorry for the tautology) a search for a phrase
which comprises one or more words. What Zebra, the search engine the Koha
uses, considers a phrase search is a search for a phrase consisting of one
or more words that comprise the entire subfield in which they appear. The
fallback is something closer to what we might consider a phrase search, but
the results can sometimes be slightly skewed (fortunately for us, my
experience has been that for the most part, the skewing is slight enough
that patrons are able to find what they want). This causes all sorts of
mind-bending confusion, particularly in the area of subject tracings.
> As for the + and - operators, if anyone tries adding that, they have to
> code it as a two-character string (space+ or space-) to prevent confusion
> when users are looking for hyphenated words.
Right now, depending on your settings, punctuation may either be ignored
(in which case "+mice -computer" will return results about computer mice
only) or considered to be letters (in which case the search will not return
any results at all). This is an example of what I was talking about above:
in order for + and - operators to really work, a lexer that can understand
them would need to be available to Koha.
Is anyone in the Koha-verse working on adding a search mode that
> uses quotation marks and + - operators? I mean, aside from the buggy
> version we have in Liblime's LAK.
There is work on incorporating solr into Koha, which is very promising, and
will fix some of these problems. Solr-based searching should be
available in 3.10, I think. A patch is currently undergoing QA to
integrate BibLibre's work on Solr into Koha, and I don't imagine it will
take too long for it to be pushed. :)
Hope that helps.
 Well, I would love to see better search lexing in Koha, and a few other
people have agreed with me that it would be a great idea (usually while
backing away slowly and hoping I don't explain how I think it should work).
 A lexer is the tool that takes the query a user enters and turns it
into a data structure that tells the search engine "this is an unambiguous
representation of what the user asked for, to the extent that the user
provided an unambiguous query." Right now Koha uses the query lexer
provided by Zebra. OCLC's query lexer understand query strings like
"pd:moz,wol,a" and turns it into a query that could be expressed in English
as "Search the derived personal name index for records where the first
component [i.e. last name] starts with 'moz' the second component [i.e.
first name] starts with 'wol' and the third component [i.e. middle name]
starts with 'a.'"
 I would love to correct the omission myself, but it's far too large a
project to do for "fun" (also, the code in question is rather painful to
look at, so it wouldn't even be that much fun!).
 Galen Charlton and I have both been doing work relating to authorities
and indexing recently that will help to resolve many of the issues with
heading linking and searching. (see, for example,
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7818 though there
are a number of other related bugs as well; most of C & P's
authority-related developments are grouped under
 As I understand it, though, we will be trading Zebra's lexer for solr's
slightly more capable lexer, which is still not the ideal.
Bibliographer, C & P Bibliography Services, LLC
(phone) +1 (917) 727-3445
(e-mail) jcamins at cpbibliography.com
More information about the Koha