0
신참자 Lucene 있습니다.Lucene 분석기 및 도트
Lucene 분석기가 문자열의 점을 무시하지 않도록 할 수있는 방법이 있습니까 ?? 예를 들어 검색 기준이 "ABCD"인 경우 Lucene은 "ABCD"가 아닌 "ABCD"가 포함 된 검색 결과의 문서 만 제공해야합니다 ....
신참자 Lucene 있습니다.Lucene 분석기 및 도트
Lucene 분석기가 문자열의 점을 무시하지 않도록 할 수있는 방법이 있습니까 ?? 예를 들어 검색 기준이 "ABCD"인 경우 Lucene은 "ABCD"가 아닌 "ABCD"가 포함 된 검색 결과의 문서 만 제공해야합니다 ....
사용하는 분석기에 대한 모든 것 . StandardAnalyzer
은 점으로 구분 된 이름이있는 some complicated things이며 "수행 할 작업"을 시도합니다. 아마도 WhitespaceAnalyzer
이 귀하의 필요에 더 잘 어울립니다.
public static void main(String[] args) throws Exception {
RAMDirectory dir = new RAMDirectory();
IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("text", "A.B.C.D DEF", Field.Store.YES, Field.Index.ANALYZED));
iw.addDocument(doc);
iw.close();
IndexSearcher searcher = new IndexSearcher(dir);
QueryParser queryParser = new QueryParser("text", new WhitespaceAnalyzer());
// prints 0
System.out.println(searcher.search(queryParser.parse("ABCD"), 1).totalHits);
// prints 1
System.out.println(searcher.search(queryParser.parse("A.B.C.D"), 1).totalHits);
}
안녕하세요, 고맙습니다 ... whitespaceanalyzer를 사용하여 어떻게 lucene에 정지 단어를 제공합니까? –
기본적으로 새로운 분석기를 작성해야합니다. 더 자세한 정보가 필요하면 새로운 질문을하는 것이 좋습니다. – itsadok