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

[EMAIL PROTECTED]
http://www.forrester.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to