Opac search using 'Does not contain' has parsing error

Bug #677122 reported by Steven Chan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Mike Rylander

Bug Description

Using the OPAC on catalog.kcls.org (version 2) or on catalogue.bclibraries.ca (version 1.6), if I do an advanced search using

Author Matches exactly 'Madonna'
Title Does not contain ' sex music'

the search hangs and an opensrf error is returned (on catalog.kcls.org at least) containing the phrase 'ERROR: syntax error in tsquery'. The returned search term looks like

author:"madonna" title:- -sex - -music

showing that the extra white space entered before 'sex' and 'music' are parsed as tokens. Instead the OPAC should remove duplicate white spaces from the search term before appending the '-' prefix, or something like that.

If the extra white spaces are not entered, the search succeeds.

Also, the OPAC is also caught spinning forever when it encounters the error; instead it should show the error in a popup box or something.

The problem seems to be related to https://bugs.launchpad.net/evergreen/+bug/605921.

Tags: opac search
Revision history for this message
Mike Rylander (mrylander) wrote :

The problem is that the OPAC code in Open-ILS/web/opac/skin/default/js/adv_global.js (adjust for skin) is blinding splitting on spaces and prepending - to each "word". This is fine, but we need to watch out for empty "words". The simplest thing to do is avoid that completely by removing doubled, leading and trailing spaces when dealing with a notcontains term. See: http://svn.open-ils.org/trac/ILS/changeset/18901

To be backported pending independent confirmation of the fix.

Note: while it wouldn't hurt to invest in avoiding this at the query parser level as well (bug #605921), that is a different, broader angle of attack.

Changed in evergreen:
importance: Undecided → Medium
status: New → Fix Committed
assignee: nobody → Mike Rylander (mrylander)
Changed in evergreen:
milestone: none → 2.0beta5
Revision history for this message
Mike Rylander (mrylander) wrote :

This is backported all the way to 1.6.1 for inclusion in 1.6.1.5.

Revision history for this message
Dan Scott (denials) wrote :

Fix released in 2.0-beta5

Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.