English 中文(简体)
当我把多个问询与卢塞内·涅茨的Boolean Query(第299页)结合起来时,问题
原标题:problem when I combine multiple queries with the Boolean Query of Lucene.net (version 2.9)

当我把多问与<条码>Lucene.net<>/code>(第29版)的Boolean Query结合起来时,我就遇到了问题。

请参看我编制索引的文件结构。

ID  Make      Model     Price   MakeDate    CreatedBy
1   Ford      Fiesta    240000  06/23/2011  anil
2   Ford      Focus     250000  06/20/2011  anil
3   Vauxhall  Astra     200000  06/21/2011  anil
4   Ford      Focus LX  230000  06/21/2011  anilkumar
5   Ford      Focus XI  260000  06/20/2011  anil

我的用意是获取包含<条码>福克斯/代码>的记录。 在任何领域,如模型或成像,领域和<代码>。 创建的By等于Anil

我提出以下询问。

WildcardQuery query4 = new WildcardQuery(new Term("Make", "*focus*"));
WildcardQuery query5 = new WildcardQuery(new Term("Model", "*focus*"));

var queryParser3 = new QueryParser(Version.LUCENE_29, "CreatedBy", analyzer1);
var query3 = queryParser3.Parse("anil");

objBool.Add(query3, BooleanClause.Occur.MUST);
objBool.Add(query4, BooleanClause.Occur.SHOULD);
objBool.Add(query5, BooleanClause.Occur.SHOULD);

在我执行时,实际上我只需要两个记录,即第二和第五。 但我只收到4份记录。

As per my understanding its returning the all the records which are CreatedBy equals to Anil.

请建议我如何取得必要的成果,以及需要作出哪些改变。

问题回答

你需要回答你提出的问题,如果你用一些方括号在假装条码上写你的话,那就更有意义了。

CreatedBy== anil  AND (make~= *focus*  OR mode~= *focus* )

你在《刑法》中需要做的是,在“管理”问询中,再补充一步。

例如:

objBool.Add(query3, BooleanClause.Occur.MUST);
objBool.Add(query4, BooleanClause.Occur.SHOULD);
objBool.Add(query5, BooleanClause.Occur.SHOULD);

将:

objBool.Add(query3, BooleanClause.Occur.MUST);

BooleanQuery nested = new BooleanQuery();
nested.Add(query4, BooleanClause.Occur.SHOULD);
nested.Add(query5, BooleanClause.Occur.SHOULD);

objBool.Add(nested, BooleanClause.Occur.MUST);

另一个需要考虑的事项是,Lucene不是一个数据库,如果你将包含制作和模型的内容加以索引,则建立一个称为<代码>MakeModel的栏目,将完全有效,从而更简单和更快地提出询问。 用卢塞恩来构建你的指数,与制造问题同样重要,甚至更为重要。

queryParser.Parse ("+Model:focus +CreatedBy:anil”)





相关问题
Search field with Thickbox issue

i have a search form which is shown with Thickbox inside an iframe. the problem is.. that after i click "search" the result page is shown inside the same iframe! and i want it to be shown in the main ...

Will an incomplete google sitemap hurt my search ranking?

If I submit a sitemap.xml which does not contain all of the pages of my site, will this affect my search ranking? For example: If my sitemap only contained pages that had been created in the last ...

speeding up windows file search with C#

i made a program that search logical drives to find a specific file .if user type file name an click search button , searching begins , but i don t know how to stop searching in the middle of process....

JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

Embed Google/ Yahoo search into a web site or build your own

I am looking for an opinion on the whether to use Google custom search, Yahoo search builder or build my own for web projects (no more than 100 pages of content). If I should build my own - do you ...

热门标签