I am currently constructing a term using the below steps,
Final Static (class level): Term t=new Term(fieldName);
Inside some function(s):
t.createTerm(termText);
It seems like createTerm method has been removed from Lucene 4.3.0 API,...
I am currently just creating the term using the constructor,
Term term = new Term(field,text);
I just thought of checking the best / efficient way to create a Term using the latest Lucene API. Can someone please guide me on that?
Very simple: new Term(fieldName, termText)
The reason for the extra constructor and createTerm() in Lucene 3.x and before was the extra cost of interning (String.intern()) the field name. In Lucene 4.0 field names are no longer interned, because the index structure changed and field<->field comparisons in term enumerations is no longer needed. So just create a term by using the constructor.
In general Term is just a light wrapper and no longer a fundamental component of Lucene, it is just used for "backwards compatibility" with earlier versions and mainly only used for constructing Query like new TermQuery(Term),.... From the implementation point of view, in Lucene 4.x every field is like a separate index, the terms of each field are represented by the new class BytesRef, which is a slice out of a larger byte[] array containing the data of many terms of a field in the index.
Uwe
http://lucene.472066.n3.nabble.com/Best-way-to-construct-term-using-Lucene-4-3-0-API-td4062388.html