Bib search hangs on searches like "title ; subtitle"

Bug #605921 reported by Galen Charlton
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Galen Charlton

Bug Description

A search on "title ; subtitle" hangs. The corresponding exception thrown looks something like this:

Received Exception:
Name: osrfMethodException
Status: *** Call to [open-ils.search.biblio.multiclass.query] failed for session [1279204250.072640.127920425021109], thread trace [1]:
Exception: OpenSRF::EX::ERROR 2010-07-15T07:30:50 OpenSRF::Application /usr/lib/perl5/site_perl/5.8.8/OpenSRF/Application.pm:202 System ERROR: Call to open-ils.storage for method open-ils.storage.biblio.multiclass.staged.search_fts.atomic
 failed with exception: Exception: OpenSRF::EX::ERROR 2010-07-15T07:30:50 OpenILS::Application::AppUtils /openils/lib/perl5/OpenILS/Application/AppUtils.pm:174 System ERROR: Exception: OpenSRF::DomainObject::oilsMethodException 2010-07-15T07:30:50 OpenSRF::AppRequest /usr/lib/perl5/site_perl/5.8.8/OpenSRF/AppSession.pm:1012 <500> *** Call to [open-ils.storage.biblio.multiclass.staged.search_fts.atomic] failed for session [1279204250.134995433.32943124451], thread trace [1]:
DBD::Pg::st execute failed: ERROR: syntax error in tsquery: "()"
CONTEXT: SQL statement "SELECT m.source AS id,
        ARRAY_ACCUM(DISTINCT m.source) AS records,
        AVG(
                (rank(x1daf7c50_keyword.index_vector,
                        to_tsquery('keyword', '('

Specifically, it is choking on part of the staged query:

to_tsquery('keyword', '(' || btrim(regexp_replace(split_date_range(naco_normalize($_9306$;$_9306$)),E'(?:\\s+|:)','&','g'),'&|') || ')')

which evaluates to

to_tsquery('keyword', '()')

The problem is that to_tsquery throws an exception on that; it does accept to_tsquery('keyword', ''), however.

Patch is in progress to have the generated SQL detect cases where the normalized search term is the empty string; although the specific case of free-floating punctuation in the query string could be handled higher up the query parser stack, I prefer doing it lower down since it is impossible to know in advance every case where a sequence of normalizers will normalize a query term away entirely.

Tags: search
Revision history for this message
Galen Charlton (gmc) wrote :

Note that a search on something like "foo : bar" hangs as well, but for a different reason:

DBD::Pg::st execute failed: ERROR: relation "metabib._field_entry" does not exist at character 2078
QUERY: SELECT m.source AS id,
        ARRAY_ACCUM(DISTINCT m.source) AS records,

Changed in evergreen:
importance: Undecided → Medium
summary: - Bib search hangs on searches like "title : subtitle"
+ Bib search hangs on searches like "title ; subtitle"
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
tags: added: search
James Fournie (jfournie)
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Jason Stephenson (jstephenson) wrote :

Ping gmc for status.

Revision history for this message
Dan Wells (dbw2) wrote :

I cannot reproduce the original bug in 2.0.2 testing, but "foo : bar" searches still fail as mentioned in the above comments. Perhaps this bug should be closed and a specific "foo : bar" bug opened?

Revision history for this message
Ben Shum (bshum) wrote :
Changed in evergreen:
status: Confirmed → 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.