Search API: How to prevent the 2000 bytes query limit?

40 views
Skip to first unread message

Jonas Hartmann

unread,
Mar 6, 2017, 9:17:44 AM3/6/17
to Google App Engine
We are using the GAE Search API since quite some time but recently hit the query limit of 2000 bytes:
java.lang.IllegalArgumentException: query string must not be longer than 2000 bytes, was 2384

We're basically having documents saved with a secondary id set as an atomic field. Within our query we do some sorting and distance calculations and also exclude docs with those secondary ids matching a list of ids with a NOT statement like following:

... AND NOT sec_id:(x AND y AND ...)

With a certain amount of excluded ids we obviously hit the limit. I could split the query into separate ones with the same base query and only use a different set of excluded ids but then the sorting is problematic.
So I am wondering if there is another way to implement this kind of query, preferably with a black and also a white list within one query (AND NOT :(..) & AND :(..)).


George (Cloud Platform Support)

unread,
Mar 6, 2017, 10:35:34 AM3/6/17
to google-a...@googlegroups.com
Hello Jonas, 

You may consider narrowing the range before sorting, memorizing often-repeating searches and other similar tricks, to improve efficiency. It may be worthwhile checking the "Search Best Practices" document.  Also, general information is to be found in the "Query Strings" document

Maybe worth mentioning: this is a discussion group specific to Google App Engine, and related problems and trends. When it comes strictly to technicalities related to query languages, you’ll be at an advantage to rather post your questions on Stackoverflow, to gain this way access to a large number of experts; it is meant for providing you help with coding.
Reply all
Reply to author
Forward
0 new messages