[Koha-devel] Searching URLs in Zebra
David Cook
dcook at prosentient.com.au
Tue Jan 19 05:31:10 CET 2016
Ah, just realized again that qq($QParser = C4::Context->queryparser if
(C4::Context->preference('UseQueryParser') && ! ($query =~
m/\w,\w|\w=\w/));) won't work in C4::Matcher because there's no $query.
The only equivalent of that would be to check all the $matchpoint->{'index'}
fields in the $self->{'matchpoints'} arrayref.
Which we might have to do because the QueryParser doesn't seem to be able to
handle the "index,phr" (ie "qualifier,qualifier") format. That's verified by
the fact that C4::Search::SimpleSearch is doing that regex.
Sure, we could just not use a list of qualifiers for a Record Matching Rule
index, but then we have no control over what index register we're using and
that's also a problem.
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St, Ultimo, NSW 2007
From: David Cook [mailto:dcook at prosentient.com.au]
Sent: Tuesday, 19 January 2016 3:11 PM
To: 'Koha Devel' <koha-devel at lists.koha-community.org>
Subject: Searching URLs in Zebra
Hey brains trust,
I'm reaching out to everyone as I'm a bit stuck with
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15541 at the
moment.
There's currently no way to search an index with the "url" (ie "u")
register. A URL is stored "as is" in that index, but all our Koha search
methods use s/:/=/g or s/=/:/g and that plays havoc with the URLs used in a
search query, which makes the match fail against the indexed URL.
C4::Matcher::get_matches() strips spaces and punctuation, so I've added a
"none" or "raw" normalizer that performs no normalization, but
C4::Search::SimpleSearch() does that global replacement for ":" and "="
(depending on your QueryParser settings and what qualifiers you've specified
in your Record Matching Rules).
I thought about adding a "skip normalization" flag to
C4::Search::SimpleSearch, but that doesn't work because C4::Matcher uses :
for QueryParser and = for non-QueryParser. except C4::Search::SimpleSearch()
deactivates QueryParser mode if you have a "index,phr" set of qualifiers.
which means that you get a ":" when you need a "=" for the non-QueryParser
CCL query.
I suppose the solution might be the following:
Current Matcher.pm:
$QParser = C4::Context->queryparser if
(C4::Context->preference('UseQueryParser'));
Current Search.pm
$QParser = C4::Context->queryparser if
(C4::Context->preference('UseQueryParser') && ! ($query =~ m/\w,\w|\w=\w/));
Future Matcher.pm:
$QParser = C4::Context->queryparser if
(C4::Context->preference('UseQueryParser') && ! ($query =~ m/\w,\w|\w=\w/));
If I just have that conditional the same in both Search.pm and Matcher.pm.
then maybe a "skip_normalization" flag in SimpleSearch() would work.
I might try that in a minute. but opening it up because I could really use a
hand with this.
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St, Ultimo, NSW 2007
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20160119/53871932/attachment-0001.html>
More information about the Koha-devel
mailing list