On Tue, 10 Jan 2006, Alf Eaton wrote:

I've been trying to use MultiFieldParser to search across multiple fields using AND as the default grouping operator.

If I use

  analyzer = StandardAnalyzer()
  qp = MultiFieldQueryParser("field1", analyzer)
  qp.setOperator(QueryParser.DEFAULT_OPERATOR_AND)
  query = qp.parseQuery(q)
  hits = searcher.search(query)

then it works to search the one field, but if I use

  analyzer = StandardAnalyzer()
  qp = MultiFieldQueryParser(["field1", "field2"], analyzer)
  qp.setOperator(QueryParser.DEFAULT_OPERATOR_AND)
  query = qp.parseQuery(q)
  hits = searcher.search(query)

then it fails, just saying "Aborted".

It seems like the constructor for MultiFieldQueryParser will only take a string as the first argument, not an array - is there a way round this?

Support for the MultiFieldQueryParser(String[], Analyzer) is missing.
The fix is simple enough and included in the patch to PyLucene.i below.

Let me know if this solves the problem for you.

Andi..

Index: PyLucene.i
===================================================================
--- PyLucene.i  (revision 225)
+++ PyLucene.i  (working copy)
@@ -3664,6 +3664,7 @@
                 class MultiFieldQueryParser : public QueryParser {
                 public:
                     MultiFieldQueryParser(jstring, janalyzer);
+                    MultiFieldQueryParser(jstringArray, janalyzer);
                     static jquery parse(jstring, jstringArray, janalyzer);
                     static jquery parse(jstring, jstringArray, jintArray, 
janalyzer);
                     static const jint NORMAL_FIELD;
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to