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