Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biocache-service compelx search query error. #778

Closed
sughics opened this issue Dec 15, 2022 · 4 comments
Closed

Biocache-service compelx search query error. #778

sughics opened this issue Dec 15, 2022 · 4 comments
Assignees
Labels
Milestone

Comments

@sughics
Copy link
Contributor

sughics commented Dec 15, 2022

  1. Reported by Martin:

The following query

https://biocache-ws.ala.org.au/ws/occurrences/search?fq=%28raw_scientificName%3A%22Apis%20cerana%20%28exotic%20strains%2C%20genotypes%20and%20sub-species%29%22%29%20AND%20decimalLongitude%3A%5B110%20TO%20154%5D%20AND%20decimalLatitude%3A%5B-55%20TO%20-10%5D%20AND%20%28year%3A%222022%22%29%20AND%20month%3A%5B12%20TO%20%2A%5D%20AND%20day%3A%5B5%20TO%20%2A%5D&disableAllQualityFilters=true&pageSize=0

returns

{
"message": "Error from server at null: org.apache.solr.search.SyntaxError: Cannot parse '(raw_scientificName:\"Apis cerana (exotic strains': Lexical error at line 1, column 49.  Encountered: <EOF> after : \"\\"Apis cerana (exotic strains\"", "errorType": "Query syntax invalid", "statusCode": 400
}

tbh I’m guessing it was the comma that caused the problem because it’s the common element among the 4 failed queries, but I could be wrong. I could easily remove it from the string, but I think it used to work, so thought I’d check

2 . Reported by @timhicks-ala via user support request

Filtering searches by collector appears broken - 400 errors on both AVH and regular Biocache, eg:
https://biocache.ala.org.au/occurrences/search?q=taxa%3A%22Geophila%22&qualityProfile=ALA&fq=collector%3A%22Forster%2C+P.I.%22

This is the the request made to biocache-service: https://biocache-ws.ala.org.au/ws/occurrences/search?q=taxa%3A%22Geophila%22&fq=collector%3A%22Forster%2C%20P.I.%22&qualityProfile=ALA&start=0&pageSize=20&sort=first_loaded_date&dir=desc&qc=&facets=taxon_name%2Cfamily%2Ccommon_name%2Cspecies_group%2Cstate%2Csensitive%2Cmonth%2Coccurrence_decade_i%2Cbasis_of_record%2Cmultimedia%2Coccurrence_status%2Cinstitution_uid%2Cdata_resource_uid%2CcontentTypes&flimit=1

returns

 {
 "message": "Error from server at null: org.apache.solr.search.SyntaxError: Cannot parse 'recordedBy:\"Forster': Lexical error at line 1, column 20.  Encountered: <EOF> after : \"\\"Forster\"", "errorType": "Query syntax invalid", "statusCode": 400
 }
@adam-collins
Copy link
Contributor

Confirmed that the problem is indeed the comma in the fq. org.springframework.core.convert.support.StringToArrayConverter is used when there is a single fq and it splits on commas. Noting that this is appropriate for the facets parameter that is the same type String[].

The fault will always occur when there is a comma in a query with a single fq value. An ugly workaround is to add &fq= to the end of a request or swap the fq containing the comma with the q that does not.

@adam-collins adam-collins self-assigned this Dec 19, 2022
@sughics
Copy link
Contributor Author

sughics commented Aug 2, 2023

Released with 3.2.0

@sughics sughics closed this as completed Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants