如何搜索GUID使用lucene.net [英] How to search GUID using lucene.net

查看:162
本文介绍了如何搜索GUID使用lucene.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用lucene.net(LUCENE_30)中,我想搜索的类别是GUID格式但不能够搜索通过使用Lucene信息搜索结果。

I am using lucene.net (LUCENE_30) in that I want to search categories which is in GUID format but not able to search that via using lucene searchresult.

难道我们搜索GUID使用Lucene搜索?

Could we search GUID using lucene search?

我的code这个样子的,其中maxResult = 10000;

My code look like this where maxResult = 10000;

QueryParser parser = new QueryParser(version, "IDTag", analyzer);
termQuery = parser.Parse(strIDTag);// where I am passing GUID value
TopDocs topDocs = searcher.Search(termQuery, maxResults);

这在topDocs后,我得到的匹配率为零。什么类型的搜索查询的可能我用,我用的QueryParser,BooleanQuery,TermQuery。任何人都可以帮助我在这?

After this in topDocs I am getting zero hits. What type of search query could I use, I have used QueryParser, BooleanQuery, TermQuery. Could anyone help me on this?

推荐答案

有是没有问题的索引和搜索在Lucene的GUID字段。您需要确保的唯一的事情是,你不通过分析处理您的查询,如果你真的与NOT_ANALYZED选项索引的字段。

There is not a problem indexing and searching GUID fields in Lucene. The only thing you need to ensure is that you are not processing your query through the analyser if you actually indexed the field with the NOT_ANALYZED option.

当你正在使用标准分析器唯一的变化到外地时,索引是改变任何文本的GUID为小写(如果由于某种原因,它是不是已经在较低的情况下)。

As you are using the Standard Analyzer the only change to the field when indexing would be to change any text in the GUID to lower case (if for some reason it isn't already in lower case).

我的建议是设置GUID字段不被分析,然后使用,而不是分析TermQuery。

My recommendation would be to set the GUID field not be Analysed, and then use a TermQuery instead of parsing.

如果你想有一个更明智的答案你真的需要提供code你已经使用索引的GUID,和你的GUID的实际样子。

If you want a more informed answer you really need to supply the code you have used to index the GUID, and what your GUID's actually look like.

这篇关于如何搜索GUID使用lucene.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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