ravendb结合搜索与地点 [英] ravendb combining Search with Where

查看:129
本文介绍了ravendb结合搜索与地点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在C#中执行乌鸦查询,并使用Where()和Search()扩展方法。
我需要这两个功能,因为我只需要返回具有特定Guid字段的索引,以及存在于文本正文中的文本。
不幸的是,Where扩展方法似乎与Search扩展方法不兼容。当我将它们结合起来时,我得到了一个像这样的Lucene查询:

I am executing a raven query in C#, and utilising both the Where() and Search() extension methods. I need both these functionalities, because I need to only return indices with a specific Guid field, AND text that exists in a body of text. Unfortunatly, the Where extension method seems to not be compatible with the Search extension method. When I combine them I get a Lucene query like this:

    Query:  FeedOwner:25eb541c\-b04a\-4f08\-b468\-65714f259ac2 MessageBody:<<request*>>

这似乎完全忽略了标准中的'MessageBody'部分 - 所以它无关紧要使用'自由文本',它没有使用它。

Which seems to completely ignore the 'MessageBody' part of the criteria - so it doesnt matter what constraint I use in the 'free text', it doesnt use it.

我已经使用'搜索'单独进行了测试,并且它可以工作 - 所以它不是free-自动搜索文本 - 只是将两者结合在一起。

I have tested with the 'Search' alone, and it works - so its not a problem with free-text searching by itself - just combining the two.

推荐答案

感谢Raven @ GoogleGroups上的@Tobias,他们指引我朝着正确的方向 - 有一个选项可以定义Where和Search子句如何组合:

Thanks to @Tobias on Raven@GoogleGroups who pointed me in the right direction - there was an option to define how the Where and Search clauses would be combined:

Query<T>.Search(candidate => candidate.MessageBody, queryString + "*", options: SearchOptions.And);

这篇关于ravendb结合搜索与地点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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