On 5/21/08, Andi Vajda <[EMAIL PROTECTED]> wrote: > > > On Tue, 20 May 2008, Rajendra Prasad Murakonda wrote: > >> 2. I was using MultiTermQueryParser with PyLucene-GCJ. I used to construct >> a >> query as a string(example: (Filed1:"value to search for" AND Field2:"Value >> to Search for")) and pass it to the parser to constuct the query and then >> execute the query. But this syntax no longer works for >> MultiTermQueryParser. >> I get an exception saying Query object expected and a str is received. But >> according to the lucene API, the parser.parse expects a query string not a >> query object. And then I figured out that parser.parse() is expecting two >> equal length lists. So do I have to pass a list of terms to search and the >> list of fields corresponding to terms etc to the parse() function? >> Is there any wrapper for the actual MultiTermQueryParser that PyLucene-JCC >> is providing? That's why the query syntax changed? >> > > It could very well have changed because of some static/non static method > naming conflicts with regards to parse(). Look at the jcc "Lucene in Action" > samples for examples on how to use MultiFieldQueryParser: > > ./samples/LuceneInAction/lia/advsearching/MultiFieldQueryParserTest.py
In the above example, MultiFieldQueryParser is used like this: query = MultiFieldQueryParser.parse("development", ["title", "subject"],[MUST, MUST], SimpleAnalyzer()) And this is what I am doing in my project: query = lucene.MultiFieldQueryParser.parse(command, ["Subject"], analyzer ) Where command is a string. Then I get an exception saying that Query object is expected and str is given. Instead of doing as above if the do the following then it works: query = lucene.MultiFieldQueryParser.parse([command], ["Subject"], analyzer ) And if I change the above as follows then I get an exception saying the length of the first parameter and second parameter doesn't match. query = MultiFieldQueryParser.parse([command], ["title", "subject"],[MUST, MUST], SimpleAnalyzer()) This clearly states that the example above is not working in my case. Is there anything I am missing? Thanks a lot for your quick replies :), - Raj PS: Your mails to the mailing list has a Reply-to header as your personal email address instead of mailing list address. Was it intentional?
_______________________________________________ pylucene-dev mailing list pylucene-dev@osafoundation.org http://lists.osafoundation.org/mailman/listinfo/pylucene-dev