You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2009/01/14 20:04:06 UTC
[Lucene-java Wiki] Trivial Update of "TheBasics" by JayDonnell
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Lucene-java Wiki" for change notification.
The following page has been changed by JayDonnell:
http://wiki.apache.org/lucene-java/TheBasics
------------------------------------------------------------------------------
IndexSearcher searcher = new IndexSearcher(directory);
Query query = new TermQuery(new Term("partnum", "Q36"));
TopDocs rs = searcher.search(query, null, 10);
- System.out.println(rs.totalHits);
+ System.out.println(rs.totalHits);
+
+ Document firstHit = searcher.doc(rs.scoreDocs[0].doc);
+ System.out.println(firstHit.getField("partnum").name());
}
}
}}}