Getting the term object from a string.
I have a school assignment that uses lucene. Essentially, I have to implement a very basic search just using normalized term frequency(per docuemnt).
I store the term frequency in a hash table(Document=>term frequency).
What I need to know is how to get at a Term object given the term as a string.
I understand how to iterate over all the terms, but how can I just get at the Term object for the specified string.
For example, I would like to do something like this:
Also, how do you get the term frequencies given a Document object?
IndexReader r = IndexReader.open("...");
Term t = r.getTerm("myterm");
Re: Getting the term object from a string.
Hi. I decided that it is not correct question. You can find Document's object, Then you can get all fields from this Document. then you can create any Term yourself. So Why do you want to get Term?