An erroneous regex in Search.pm makes that some search expressions are marked ccl= queries while they do not contain an index name.
Note that these queries contain a : or = (Users should not enter them if they do not intend to use indexes, but unfortunately they do.)
opac-search.pl?q=rembrandt+%3A contains the index name "an" (for authority); this search results in an 500 error.
opac-search.pl?q=hals+%3A does not contain an index name and gives results
opac-search.pl?q=vermeer+%3A does not contain an index name and gives results
A tiny adjustment in the regex and a change in the loop structure makes the code slightly faster and solves the false index detections. While doing that, I included a comparison with lowercase. This makes index names in searches case insensitive.
Created attachment 5145 [details] [review]
*** Bug 6317 has been marked as a duplicate of this bug. ***
Created attachment 5251 [details] [review]
I can confirm the bug and the solution.
* perfect test case
* small patch, nothing to say from a QA POV
marking passed QA !
Pushed, please test
this breaks searches for Control-number as used to link back from analytics to serials using $w in MARC21.
- Add a record and fill in 001
- Try to search for Control-number:<001> in a keyword search
This needs to be reverted until a better fix can be found that does not break existing features.
(In reply to comment #6)
> this breaks searches for Control-number as used to link back from analytics to
> serials using $w in MARC21.
> This needs to be reverted until a better fix can be found that does not break
> existing features.
Good catch, Katrin. I think we should not revert it; only a small change in the regex in buildQuery is needed. Problem here seems to be the hyphen in Control-number.
I tested this one:
And it seems to work.
I hope to send a follow up patch for this tomorrow. If you are faster, that is fine too.
Created attachment 6572 [details] [review]
Follow up fix for hyphens in index names
Created attachment 6573 [details] [review]
Bug 6786: Follow up fixing index names with hyphens
Adds hyphen to regex looking for index names in buildQuery.
Test by searching on Control-number=...
Signed-off-by: Chris Cormack <email@example.com>
QA Request for Paul or Ian:
Could you please set this to Passed QA and push it. Resolves searching on index names with hyphen.
Can and should be applied to 3.6.X too.
Adds hyphen back into regex, which is required for many/most of the search indexes in bib1.att.
Please note that / is also used in several of the bib1.att indexes... now as to whether we actually support those particular indexes, I'm not sure, but theoretically, we should probably also include regex matching for / as well.
follow-up patch pushed, please test
Chris: the patch was pushed on new/bug_6786 branch, but it should have been a follow-up. Where did you pushed the initial fix ? did I missed something ?
I see both patches in master and 3.6.x now. Search for "Control-number" works in master.