简体   繁体   中英

HibernateSearch/Lucene searching in index with undersclore

I declared a field where I wanna save values with underscores in it. Therefore I marked the field with the @Field annotation like:

@Field(name = "underscoreField", index = Index.UN_TOKENIZED).

In Luke I can see that the index is created correctly. For instance:

ABC_EF_AB

When I search for "ABC_EF_AB" or "ABC_" I can't find any result. I already tried the Standard and the Keyword Analyzer.

Thanks

Try the WhitespaceAnalyzer . It uses a WhitespaceTokenizer that breaks at whitespace, so it should allow underscores.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM