Andi Vajda <[email protected]> wrote:
> 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
Wow, looks like a lot. My implementations just have implementations of
getFieldQuery() and getRangeQuery().
> implementation. Also take a look at test/test_PythonQueryParser.py for
> an example on what the new methods look like (hint:
> getFieldQuery_quoted()).
Looking at that, it seems that one needn't provide implementations for
most of the native methods -- your example classes don't. How should one
know which to implement? The ones that could get called, I suppose.
Bill
>
> 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
> >
repl: bad addresses:
[email protected] Andi Vajda <[email protected]> -- junk
after local@domain (Andi)