On 13 Apr 2006, at 16:23, Andi Vajda wrote:

but in Java I can't work out how to phrase the code so that it works properly. What I'm trying to do is:

String[] fields = {"field_a","field_b"}; Analyzer analyzer = new StandardAnalyzer(stopwords);
        QueryParser qp = new MultiFieldQueryParser(fields, analyzer);
        qp.setOperator(QueryParser.DEFAULT_OPERATOR_AND);
        Query query = qp.parse(q);
      Hits hits = searcher.search(query);

The simplest way to debug this is to look at the sources for MultiFieldQueryParser.java. The Java Lucene trunk version is here: http://svn.apache.org/repos/asf/lucene/java/trunk/src/java/org/ apache/lucene/queryParser/MultiFieldQueryParser.java

If you need to look at an older release's version, PyLucene 1.9.1 was built from http://svn.apache.org/repos/asf/lucene/java/tags/ lucene_1_9_1

That's where I get confused, because it has

  public MultiFieldQueryParser(String[] fields, Analyzer analyzer) {
    super(null, analyzer);
    this.fields = fields;
  }

right at the start.

alf.
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to