lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Belanger" <rbelan...@forrester.com>
Subject Question on the use of MultiFieldQueryParser
Date Sun, 29 Sep 2002 23:26:32 GMT

Hi:

I am trying to use a MultiFieldQueryParser to query across three Text
fields (title, author, and content) where content is a large XML file that
has had the XML tags stripped out.  The result set I get back seems to be
from only one field, though - the one with the highest scoring document.
Ideally I would like to get back a result set with results from all three
fields and then make my own decisions on results to display. Any
suggestions for how to do that would be greatly appreciated.  Here's what I
am doing now:

     String qFields[] = new String[3];
     qFields[0] = "contents";
     qFields[1] = "title";
     qFields[2] = "author";

      Searcher searcher = new IndexSearcher(IndexDir);
          Analyzer analyzer = new StandardAnalyzer();
          Query query =  MultiFieldQueryParser.parse(instring,qFields,
analyzer);
          hits = searcher.search(query);

     for (int i = 0 ; i < resultSet.length() ; i++) {
          thisscore = Math.round(resultSet.score(i) * 100);
          if (thisscore > 10 ) {
          Document doc = resultSet.doc(i);
          String path = doc.get("path");
          String title = doc.get("title") + " (" + thisscore + "%)";
          v.addElement(title);  }  }


Thanks,

Rich

Richard C. Belanger
Chief Technology Officer
Forrester Research
400 Technology Square
Cambridge, MA 02139

rbelanger@forrester.com
http://www.forrester.com


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message