2

这些查询不起作用:

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

代码

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

例外

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)

版本

appengine-api-1.0-sdk-1.8.6.jar

参考

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

4

1 回答 1

2

看起来语法是错误的。根据您提供的参考资料,因为

"weather=stormy" "weather: stormy"是等价的,试试:

"year<=2008 OR year=2011"

(假设这是您在示例中的意图)。

于 2013-11-08T21:26:11.020 回答