简体   繁体   English

HibernateSearch / Lucene在带底线的索引中搜索

[英]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注释将字段标记为:

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

In Luke I can see that the index is created correctly. 在Luke中,我可以看到索引创建正确。 For instance: 例如:

ABC_EF_AB ABC_EF_AB

When I search for "ABC_EF_AB" or "ABC_" I can't find any result. 当我搜索“ ABC_EF_AB”或“ ABC_”时,找不到任何结果。 I already tried the Standard and the Keyword Analyzer. 我已经尝试过标准和关键字分析器。

Thanks 谢谢

Try the WhitespaceAnalyzer . 试试WhitespaceAnalyzer It uses a WhitespaceTokenizer that breaks at whitespace, so it should allow underscores. 它使用在空白处中断的WhitespaceTokenizer,因此应允许使用下划线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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