본문 바로가기

Lucene

[lucene] 필드별 Analyzer 지정

PerFieldAnalayzerWrapper analyzer = new PerFieldAnalyzerWrapper(new SimpleAnalyzer());

analyzer.addAnalyzer("field_name", new KeywordAnalyzer());

Query query = QueryParser.parse("filed_name:S12 AND SPACE", "descrption", analyzer);

Hits hits = searcher.search(query);

...