Search code examples
javaandroidlucenehighlighting

Can't find TokenSources class in Lucene 3.6?


I'm using Lucene in my Android app to build a dictionary. What I want to accomplish is that when the user types a word, it queries not only the dictionary entries but their contents as well. The output would be a dynamically updating ListView which contains the word on the top row, and in the second row, the part of the definition in which the word appears. To accomplish that, I'm following this tutorial: http://hrycan.com/2009/10/25/lucene-highlighter-howto/

However, I could not find the class TokenSources. I am using Lucene 3.6. In fact, the entire parent package org.apache.lucene.search.highlight doesn't seem to be available in this version. Where can I find it?


Solution

  • org.apache.lucene.search.highlight is distributed with Lucene, but in a separate jar from the lucene-core jar. You should find in the contrib directory (ie. lucene/contrib/highlighter/lucene-highlighter-3.6.1.jar).