Mailing List Archive

How can i specify a custom Analyzer for a Field of Document?
Directory indexDataDir = FSDirectory.open(Paths.get("index_data"));
Analyzer analyzer = MyLuceneAnalyzerFactory.newInstance();
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
iwc.setOpenMode(OpenMode.CREATE);
iwc.setRAMBufferSizeMB(256.0);
IndexWriter indexWriter = new IndexWriter(indexDataDir, iwc);

like the above code which i use for building index, the problem is, Why i
can only set 1 analyzer for the whole index?

I have a document set, most fields to index is only text type, suited for a
StandAnalyzer or a SmartChineseAnalyzer. But the problem is, i have a
special field which is a KeywordList type, like "A;B;C", which i hope i can
fully control the analyzing step.

How to do this in Lucene?
Re: How can i specify a custom Analyzer for a Field of Document? [ In reply to ]
You can check how SolrAnalyzer switches chains across fields.

On Tue, Dec 10, 2019 at 9:41 AM ??? <ctengctsh@gmail.com> wrote:

> Directory indexDataDir = FSDirectory.open(Paths.get("index_data"));
> Analyzer analyzer = MyLuceneAnalyzerFactory.newInstance();
> IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
> iwc.setOpenMode(OpenMode.CREATE);
> iwc.setRAMBufferSizeMB(256.0);
> IndexWriter indexWriter = new IndexWriter(indexDataDir, iwc);
>
> like the above code which i use for building index, the problem is, Why i
> can only set 1 analyzer for the whole index?
>
> I have a document set, most fields to index is only text type, suited for a
> StandAnalyzer or a SmartChineseAnalyzer. But the problem is, i have a
> special field which is a KeywordList type, like "A;B;C", which i hope i can
> fully control the analyzing step.
>
> How to do this in Lucene?
>


--
Sincerely yours
Mikhail Khludnev