Solr/lucene 术语中用于模糊匹配的最大字符数
我正在尝试使用 Solr 进行模糊匹配实验。
在我的文档索引first_name字段中,我提到为“MYNEWORGANIZATION20SEP2011” - 实际上这个词是“My New Organization 20-Sep-2011”,但我删除了空格和其他字符。
现在,如果我直接作为查询“MYNEWORGANIZATION20SEP2011”搜索,Solr 将得到 1 个结果,如上面的文档 ID,完美!
但是,如果我从此字符串中删除两个字符,并且在查询中如果我提供“MYNEWORGANIZATION20SEP20~0.8”,我将得到 0 个结果。
对于我的新查询 MYNEWORGANIZATION20SEP20 与主文档数据的距离是 2 - 因此 % 匹配应该是 > 90% 匹配,因此它仍然应该搜索数据(在我的查询中,我只指定 80% 匹配。
顺便说一句,如果我使用first_name 作为 6-7 个字符(如“rushik”)并提供模糊查询(如“rushik~0.75”),则搜索 在上述两种情况下,
我都使用字段类型“text_general” - 使用 solr 3.3
是否有任何字符限制 。 Solr 或者它可以在任何地方进行配置? - 我使用默认的 solr 配置,没有更改 solrconfig.xml 中的任何内容
是否有更好的方法来搜索“My New Organization 20-Sep-2011”,例如带有模糊查询的字符串,而无需手动删除空格。
谢谢, 鲁希克。
I am trying to experiment fuzzy match with Solr.
In my document indexed first_name field I mentioned as "MYNEWORGANIZATION20SEP2011" - actually the word was "My New Organization 20-Sep-2011" but I removed spaces and other chars.
Now above word (without spaces) if I search directly as query "MYNEWORGANIZATION20SEP2011" Solr is resulting 1 result as above document ID, perfect !
But if I trim two chars from this string and in query if I provide "MYNEWORGANIZATION20SEP20~0.8", I am getting 0 results.
for my new query MYNEWORGANIZATION20SEP20 distance with main document data is 2 - thus % match should be > 90% match, thus it should still search the data (in my query I am specifying only 80% match.
BTW, if I use first_name as 6-7 chars like "rushik" and provide fuzzy query like "rushik~0.75", search is working properly and returning the data.
In both the above cases I am using field type as "text_general" - using solr 3.3.
Do we have any chars limitation for fuzzy search in Solr or it can be configurable anywhere ? - I am using default solr configuration, not changed anything in solrconfig.xml
Is there any better way to search "My New Organization 20-Sep-2011" like string with fuzzy query without manually removing spaces.
Thanks,
Rushik.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所在领域的索引时间分析是怎样的?
文本通用字段通常会经过空格标记器、停用词过滤器、单词分隔符和小写过滤器,在这种情况下,您的索引字段完全不同。
是从我的新组织 20-Sep-2011 -> 转换而来吗? MYNEWORGANIZATION20SEP2011 在索引之前由您完成?
此外,最重要的模糊搜索不会进行查询时间分析。
您可能希望使用字段类型作为字符串或小写字段类型,例如
并使用小写测试查询。
Whats the index time analysis done on your field ?
The text general field usually goes through the white space tokenizer, stopword filter, word delimiter and lower case filter, in which case you indexed field is completely different.
Is the conversion from My New Organization 20-Sep-2011 -> MYNEWORGANIZATION20SEP2011 done by you before indexing?
Also, most important Fuzzy searches don't undergo query time analysis.
You may want to use the field type as string or lowercase case fieldtype e.g.
and test Query using lower case.