With Lucene, is it possible to do a straight term lookup without having to iterate over the terms?
For ex:
IndexReader r = IndexReader.open("...");
Term t = r.getTerm("myterm");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you need to first read a basic lucene tutorial such as this. Note that the code used in the tutorial is old, i.e., does not correspond to the latest lucene version. From your comment to Mike, I believe are looking for “search”.
An alternative is to use a wrapper over lucene such as Elasticsearch that provides a simple interface. Nevertheless, it is important to understand the interface before using it.