在Lucene中搜索两个字母的单词 [英] Search for two-letter words in Lucene

查看:66
本文介绍了在Lucene中搜索两个字母的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找包含首字母缩略词"IT"的文档.

I'm trying to find documents containing the acronym "IT".

我尝试使用StandardAnalyzer,SimpleAnalyzer和KeywordAnalyzer进行搜索-相同的结果(完全没有命中).

I've tried searching using the StandardAnalyzer, SimpleAnalyzer and KeywordAnalyzer - same result (no hits whatsoever).

据我所知,它"不是默认停用词的一部分吗?

As far as I can see, "it" isn't part of the default stop words?

可以使用通配符搜索找到文档,所以我知道它们在索引中.

I can find the documents using a wildcard search, so I know they're in the index.

任何帮助将不胜感激!干杯!

Any help is greatly appreciated! Cheers!

推荐答案

我尝试了在没有任何停用词的情况下重新索引...

I tried re-indexing without any stop words...

new IndexWriter(directory,
                new StandardAnalyzer(Version.LUCENE_30, new HashSet<string>()), // No stop words
                true,
                IndexWriter.MaxFieldLength.UNLIMITED);

...然后,只要我使用相同类型的分析仪(没有任何停用词)进行搜索,便可以搜索"":

...and after that I was able to search for "it" as long as I used the same type of analyzer (without any stop words) for searching:

new StandardAnalyzer(Version.LUCENE_30, new HashSet<string>()

这篇关于在Lucene中搜索两个字母的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆