Hi,
I have "Doc. Id" of the document stored in the database. Now I want to
query database on that "Doc. Id" (which will always return one document).
How can I do this?
To avoid confusion, I am talking about the "Doc. Id" which Lucene
automatically creates for every document and hence is unique for every
Document.
String Database = null;
QueryParser queryParser = new QueryParser("Doc. Id",new
WhitespaceAnalyzer());
Query query;
Hits hits;
try {
query = queryParser.parse(String.valueOf(docIDs[i]));
hits = searcher.search(query);
Document doc = hits.doc(0);
Database = doc.get("title");
} catch (ParseException e) {
e.printStackTrace();
}
Kindly suggest me.
Thanks