Issue 12954

Multi value occurrence search not working

12954
Reporter: mdoering
Assignee: fmendez
Type: Bug
Summary: Multi value occurrence search not working
Priority: Critical
Resolution: Fixed
Status: Closed
Created: 2013-03-05 17:35:47.798
Updated: 2013-08-29 14:44:49.673
Resolved: 2013-03-06 15:01:19.265
        
Description: When I create a complex query with
 - basis of record one of: LITERATURE, LIVING_SPECIMEN, MACHINE_OBSERVATION or FOSSIL_SPECIMEN
 - year one of: before 1900, equals to 2000 or between 1990,1998
 - month one of: january, may or september

I dont get any result:
http://staging.gbif.org:8080/portal/occurrence/search?BASIS_OF_RECORD=LITERATURE&BASIS_OF_RECORD=LIVING_SPECIMEN&BASIS_OF_RECORD=MACHINE_OBSERVATION&BASIS_OF_RECORD=FOSSIL_SPECIMEN&YEAR=*%2C1900&YEAR=2000&YEAR=1990%2C1998&MONTH=5&MONTH=1&MONTH=9

But if I use a narrower query with just literature basis of record I get 574 hits:
http://staging.gbif.org:8080/portal/occurrence/search?BASIS_OF_RECORD=LITERATURE&YEAR=*%2C1900&YEAR=1990%2C1998&YEAR=2000&MONTH=9&MONTH=1&MONTH=5
]]>
    


Author: fmendez@gbif.org
Comment: usign those links that you provided i got 0 results for both
Created: 2013-03-06 11:44:00.951
Updated: 2013-03-06 11:44:00.951


Author: mdoering@gbif.org
Created: 2013-03-06 12:52:57.719
Updated: 2013-03-06 12:52:57.719
        
Im getting zero records now too.
But if you only leave one basis of record and try with one or two month you hit the described problem:

Matches 559 records with September only:
http://staging.gbif.org:8080/portal/occurrence/search?BASIS_OF_RECORD=LITERATURE&YEAR=1990%2C1998&MONTH=9

Zero matches if you also add May:
http://staging.gbif.org:8080/portal/occurrence/search?BASIS_OF_RECORD=LITERATURE&YEAR=1990%2C1998&MONTH=9&MONTH=5
    


Author: fmendez@gbif.org
Comment: i've found the error, the occurrence-request-builder, was not grouping the filters correctly, the interpreted lucene query hadn't parantheses for filters applied to the same field: for example: basis_of_record:0 OR basis_of_record:1 OR basis_of_record:2 AND year:1000 OR year:[* TO 2000] was produced instead of  (basis_of_record:0 OR basis_of_record:1 OR basis_of_record:2) AND (year:1000 OR year:[* TO 2000])
Created: 2013-03-06 14:05:04.583
Updated: 2013-03-06 14:05:04.583


Author: fmendez@gbif.org
Comment: http://code.google.com/p/gbif-occurrencestore/source/detail?r=1922
Created: 2013-03-06 15:01:19.312
Updated: 2013-03-06 15:01:19.312


Author: mdoering@gbif.org
Comment: Nice!
Created: 2013-03-06 16:14:59.492
Updated: 2013-03-06 16:14:59.492