catalog search fails if query contains punctuation tokens

Bug #1180066 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned
2.4
Fix Released
Undecided
Unassigned

Bug Description

Consider the following keyword search:

 Take me to the river / Al Green and Mabon

This fails with the following PostgreSQL error:

ERROR: malformed array literal: "{take,me,to,the,river,,al,green,and,mabon,hodges}"
CONTEXT: PL/pgSQL function "query_parser_fts" line 64 at FETCH
STATEMENT: SELECT * -- bib search: #CD_documentLength #CD_meanHarmonic #CD_uniqueWords keyword: Take me to the river / Al Green and Mabon Hodges. depth(0) estimation_strategy(inclusion) limit(1000) core_limit(10000)
               FROM search.query_parser_fts(
...
           * evergreen.rel_bump(('{' || search_normalize($_32444$Take$_32444$) || ',' || search_normalize($_32444$me$_32444$) || ',
' || search_normalize($_32444$to$_32444$) || ',' || search_normalize($_32444$the$_32444$) || ',' || search_normalize($_32444$river$
_32444$) || ',' || search_normalize($_32444$\/$_32444$) || ',' || search_normalize($_32444$Al$_32444$) || ',' || search_normalize($
_32444$Green$_32444$) || ',' || search_normalize($_32444$and$_32444$) || ',' || search_normalize($_32444$Mabon$_32444$) || ',' || s
earch_normalize($_32444$Hodges\.$_32444$) || '}')::TEXT[], x9fb9a30_keyword.value, '{word_order}'::TEXT[], '{20}'::NUMERIC[]))
...
           * evergreen.rel_bump(('{' || search_normalize($_32444$Take$_32444$) || ',' || search_normalize($_32444$me$_32444$) || ',' || search_normalize($_32444$to$_32444$) || ',' || search_normalize($_32444$the$_32444$) || ',' || search_normalize($_32444$river$_32444$) || ',' || search_normalize($_32444$\/$_32444$) || ',' || search_normalize($_32444$Al$_32444$) || ',' || search_normalize($_32444$Green$_32444$) || ',' || search_normalize($_32444$and$_32444$) || ',' || search_normalize($_32444$Mabon$_32444$) || ',' || search_normalize($_32444$Hodges\.$_32444$) || '}')::TEXT[], x9fb9a30_keyword.value, '{word_order}'::TEXT[], '{20}'::NUMERIC[]))
         )+1 * COALESCE( NULLIF( FIRST(mrd.attrs @> hstore('item_lang', $_32444$eng$_32444$)), FALSE )::INT * 5, 1)))::NUMERIC AS rank,
...

The problem is that ',' || search_normalize($_32444$the$_32444$) || ',' becomes ',,' -- which PostgreSQL consider a syntax error for text array literals.

This is a regression; in 2.3, this sort of search would complete and (as expected) would simply ignore the /.

Evergreen 2.4.0

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

Fix is available in the user/gmcharlt/lp1180066_punct_tokens branch in the working/Evergreen repository:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/gmcharlt/lp1180066_punct_tokens

tags: added: pullrequest
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

This fix tests well for me. Thanks Galen! Pushed to master and rel_2_4.

Changed in evergreen:
milestone: none → 2.5.0-alpha
status: New → Fix Committed
Ben Shum (bshum)
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.