Frage

These queries won't work:

INFO: Searching with query:  year:(<=2008 OR  2011) 
INFO: Searching with query:  year:(<=2008)

Code

    log.info("Searching with query: " + q);
    try {
        Results<ScoredDocument> results = getIndex().search(q);

Exception

INFO: Searching with query:  year:(<=2008 OR  2011) 
line 1:7 no viable alternative at input '<='
Nov 08, 2013 3:36:03 PM org.apache.struts2.dispatcher.Dispatcher error
SEVERE: Exception occurred during processing request: Unable to parse query:  year:(<=2008 OR  2011) 
com.google.appengine.api.search.SearchQueryException: Unable to parse query:  year:(<=2008 OR  2011) 
at com.google.appengine.api.search.checkers.QueryChecker.checkQueryParses(QueryChecker.java:44)
at com.google.appengine.api.search.checkers.QueryChecker.checkQuery(QueryChecker.java:28)
at com.google.appengine.api.search.Query$Builder.setQueryString(Query.java:91)
at com.google.appengine.api.search.Query$Builder.build(Query.java:107)
at com.google.appengine.api.search.IndexImpl.searchAsync(IndexImpl.java:378)
at com.google.appengine.api.search.IndexImpl.search(IndexImpl.java:479)

Version

appengine-api-1.0-sdk-1.8.6.jar

Reference

https://developers.google.com/appengine/docs/java/search/query_strings

War es hilfreich?

Lösung

Looks like syntax is wrong. Based on the reference you provided, since

"weather=stormy" "weather: stormy" are equivalent, try:

"year<=2008 OR year=2011"

(assuming that is what you intended in your example).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top