Upgrading to Lucene 3.0
Posted by Kelvin on 28 Apr 2010 at 07:58 pm | Tagged as: programming, Lucene / Solr / Elasticsearch / Nutch
Recently upgraded a 3-year old app from Lucene 2.1-dev to 3.0.1.
Some random thoughts to the evolution of the Lucene API over the past 3 years:
I miss Hits
Sigh. Hits has been deprecated for awhile now, but with 3.0 its gone. And I have to say its a pain that it is.
Where I used to pass the Hits object around, now I need to pass TopDocs AND Searcher in order to get to documents.
Instead of
Document doc = hits.doc(i);
its now
Document doc = searcher.doc(topdocs.scoreDocs[i].doc);
Much more verbose with zero benefit to me as a programmer.
Nice number indexing via NumericField
Where I previously had to pad numbers for lexicographic searching, there's now a proper NumericField and NumericRangeFilter.
Lockless commits
What more can I say? Yay!!
What has not changed…
Perhaps somewhat more important than what has changed, is what has remained the same, which is 95% of the API and the query language.
3 years is a mighty long time and Lucene has experienced explosive growth during this period. The overall sanity of change is a clear sign of Lucene's committers' dedication to simplicity and a hat-tip to Doug's original architecture and vision.