"This search query matches too many different words. Try making it less general" - Error
Hello,
When retrieving documents using the `retrieve` function, I'm getting the error in the title. The use case is that each document has a field with an UUID, and I want to get all the documents in the range of 2 UUIDs:
Query registryIdQuery = Query.Factory.createFieldQuery(registryIdField, Condition.EQUAL, tableId);
Query recordIdQuery = Query.Factory.createFieldQuery(recordIdField, Condition.IN_RANGE, recordIdsRange);
Query[] queries = new Query[]{registryIdQuery, recordIdQuery};
Query query = Query.Factory.createAndQuery(queries, new HashMap<>());
List<AnnotatedPluginDocument> existingDocsFromBatch = registryFolderService.retrieve(query, ProgressListener.EMPTY);
Where recordIdsRange is an array of 2 UUIDs.
The underlying cause seems to be:
org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 8192
Is Geneious converting the range into single boolean queries, one for each UUID in the range?
-
What is the data type of recordIdField? The Geneious local database is only supposed to advertise that it supports range queries as a valid option for numeric and date fields, but there isn't anything stopping you from passing in a range query on other data types if you use the Geneious API rather than the Geneious UI.
It seems like on non-numeric fields at least, Lucence (which is the search library Geneious uses), won't handle it well. There is some information on why this happens at https://dalelane.co.uk/blog/?p=2081
There probably isn't anything you can do about this for non-numeric fields. But if your field is currently non-numeric, you might get it to work by changing it to a numeric field.
0 -
The field type is a String indeed.
I ended up doing the following workaround:
Instead of using Condition.IN_RANGE, I do batches of 8192 strings, and then used a Condition.EQUALS for each string, and make an OR query with all of them. Not too elegant but worked.
0
Please sign in to leave a comment.
Comments
2 comments