On Thu, Mar 13, 2008 at 10:40 AM, John Wang <[EMAIL PROTECTED]> wrote:
> Hi all: > > Maybe this has been asked before: > > I am building an index consists of multiple languages, (stored as a > field), and I have different analyzers depending on the language of the > language to be indexed. But the IndexWriter takes only an Analyzer. > > I was hoping to have IndexWriter take an AnalyzerFactory, where the > AnalyzerFactory produces Analyzer depending on some criteria of the > document, e.g. language. > > Maybe I am going about the wrong way. > > Any suggestions on how to go about? > Perhaps this is what you are searching for: http://lucene.apache.org/java/2_3_0/api/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.html With PerFieldAnalyzerWrapper, you can specify which analyzer to use with each field, as well as a default analyzer. cheers, asgeir