Yes, but usually it's a good idea to add documents in batch and not having to reinstantiate the writer for every document and then closing it.
It would be nice if one can specify to the writer which analyzer to use. PerfieldAnalyzer wouldn't work because different analyzers may apply on the same field depending on the doc, e.g. if (field1.name.equals("fr")) use FrenchAnalyzer on content field etc. -John On Thu, Mar 13, 2008 at 4:53 AM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > On IndexWriter, you can pass in the Analyzer when you add a Document, > thus your application can identify the language, choose the analyzer > for the given doc, and then add the document > > See > public void addDocument(Document doc, Analyzer analyzer) > > > On Mar 12, 2008, at 8:40 PM, John Wang 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? > > > > Thanks > > > > -John > > -------------------------- > Grant Ingersoll > http://www.lucenebootcamp.com > Next Training: April 7, 2008 at ApacheCon Europe in Amsterdam > > Lucene Helpful Hints: > http://wiki.apache.org/lucene-java/BasicsOfPerformance > http://wiki.apache.org/lucene-java/LuceneFAQ > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >