Hi Bill,
The QueryParser class changed a bit. More overloads were introduced on the
Lucene side. You probably have a Python 'subclass' of QueryParser that needs
a bit of work to adapt to the changes.
Look at the new version in
apache/pylucene-3.1/java/org/apache/pylucene/queryParser/PythonQueryParser.java
and see the native methods that you're missing on your Python
implementation. Also take a look at test/test_PythonQueryParser.py for an
example on what the new methods look like (hint: getFieldQuery_quoted()).
With a default QueryParser instance, your query parses just fine:
>>> from lucene import *
>>> initVM()
<jcc.JCCEnv object at 0x10029d0f0>
>>> qp = QueryParser(Version.LUCENE_CURRENT, "foo",
StandardAnalyzer(Version.LUCENE_CURRENT))
>>> qp.parse("categories:RSSReader AND id:[00000-00-0000-000 TO 01299-51-3142-795]
AND NOT categories:RSSReader/_noexpire_")
<Query: +categories:rssreader +id:[00000-00-0000-000 TO 01299-51-3142-795]
-(categories:rssreader categories:_noexpire_)>
Andi..
On Wed, 6 Apr 2011, Bill Janssen wrote:
I'm seeing parse failures on this query string:
"categories:RSSReader AND id:[00000-00-0000-000 TO 01299-51-3142-795] AND NOT
categories:RSSReader/_noexpire_"
thr002: RSSReader: Traceback (most recent call last):
thr002: File "/local/lib/UpLib-1.7.11/site-extensions/RSSReader.py", line
271, in _scan_rss_sites
thr002: hits = repo.do_query("categories:RSSReader AND id:[00000-00-0000-000 TO
%s] AND NOT categories:RSSReader/_noexpire_" % old_id)
thr002: File "/local/share/UpLib-1.7.11/code/uplib/repository.py", line 1172,
in do_query
thr002: results = self.do_full_query(query_string, searchtype)
thr002: File "/local/share/UpLib-1.7.11/code/uplib/repository.py", line 1196,
in do_full_query
thr002: results = self.pylucene_search(searchtype, query_string)
thr002: File "/local/share/UpLib-1.7.11/code/uplib/repository.py", line 1081,
in pylucene_search
thr002: v = self.__search_context.search(query_string)
thr002: File "/local/share/UpLib-1.7.11/code/uplib/indexing.py", line 913, in
search
thr002: parsed_query = query_parser.parseQ(query)
thr002: File "/local/share/UpLib-1.7.11/code/uplib/indexing.py", line 550, in
parseQ
thr002: query = QueryParser.parse(self, querystring)
thr002: JavaError: org.apache.jcc.PythonException: getFieldQuery_quoted
thr002: AttributeError: getFieldQuery_quoted
thr002: Java stacktrace:
thr002: org.apache.jcc.PythonException: getFieldQuery_quoted
thr002: AttributeError: getFieldQuery_quoted
thr002: at
org.apache.pylucene.queryParser.PythonMultiFieldQueryParser.getFieldQuery_quoted(Native
Method)
thr002: at
org.apache.pylucene.queryParser.PythonMultiFieldQueryParser.getFieldQuery(Unknown
Source)
thr002: at
org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1421)
thr002: at
org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1309)
thr002: at
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1237)
thr002: at
org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1226)
thr002: at
org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
Bill