I am using lucene.Net for searching in my application. I have to search in two fields so I am adding two term queries in a boolean query and the resulted boolean query is +(location:a* +(id:19))
我正在使用lucene.Net在我的应用程序中搜索。我必须在两个字段中搜索,所以我在布尔查询中添加两个术语查询,结果布尔查询是+(位置:a * +(id:19))
I am using pagination to display results to the user. When I want to get next n records in my result set I am again exeuting the same search.
我正在使用分页来向用户显示结果。当我想在我的结果集中获得下一个n条记录时,我再次进行相同的搜索。
When executing search for the next time I dont want to prepare the query and I want o use the same query "+(location:a* +(id:19))" as is.
当我下次执行搜索时,我不想准备查询,并且我想要使用相同的查询“+(location:a * +(id:19))”。
How do I use it, which query should I use..because al most all types query requires field name. But I have the query which is parsed and want to use as is.
我如何使用它,我应该使用哪个查询...因为大多数类型查询都需要字段名称。但我有解析的查询,并希望按原样使用。
Please let me know if some body has any idea.
如果有人知道,请告诉我。
1 个解决方案
#1
- Use the Queryparser.Parse() method to parse the query string and get a Query object.
- Store the Query object for the next round.
- Use one of the Searcher.Search() methods with the stored Query.
使用Queryparser.Parse()方法解析查询字符串并获取Query对象。
存储查询对象以进行下一轮。
将Searcher.Search()方法之一与存储的Query一起使用。
#1
- Use the Queryparser.Parse() method to parse the query string and get a Query object.
- Store the Query object for the next round.
- Use one of the Searcher.Search() methods with the stored Query.
使用Queryparser.Parse()方法解析查询字符串并获取Query对象。
存储查询对象以进行下一轮。
将Searcher.Search()方法之一与存储的Query一起使用。