Linq to Lucene:“Lucene 术语的谓词不能是空字符串。”
我正在尝试在我的项目中实现 Linq To Lucene,但是当尝试搜索某些内容时,我总是得到 Enumeration returns no results
结果,当我调试并尝试打开我的 [ IndexContext].[TableProperty]
在 Watch
窗口中,我收到以下消息:
Lucene Term 的谓词不能 为空字符串。
我尝试在谷歌中搜索这个,但显然没有返回任何结果!
有人以前遇到过这个消息吗? 我该如何解决它? 因为目前它没有返回任何数据
[更新]
显然问题是当我使用扩展方法之一时(Between
、Match
、< code>Like 等...),可在 Lucine.Linq.Extensions
中找到。 举个例子:
var db = new MusicRepo_DB_IndexContext(@"C:\MusicRepoDB_index",
new MusicRepo_DBDataContext());
下面的查询返回一个结果:db.Artists.Where(a => a.Name == "Camel");
但这个查询却没有:db .Artists.Where(a => a.Search("Camel"));
[更新]
经过进一步测试,我意识到 Match
扩展方法实际上会返回结果,而其他方法(Search
、Like
)则不会。 我还在为这个问题苦苦挣扎
I am trying to implement Linq To Lucene in my project, but when trying to search for something, I am always getting a Enumeration yielded no results
result and when I debug and try to open my [IndexContext].[TableProperty]
in the Watch
window, I am getting this message:
The predicate of a Lucene Term can not
be the empty string.
I have tried searching in Google for this, but apparently it returned no results!
Has anyone ever encountered this message before? And how can I fix it? because currently it's not returning any data
[Update]
Apparently the problem is when I am using one of the Extension Methods (Between
, Match
, Like
etc...) that are found in Lucine.Linq.Extensions
. Take the following example:
var db = new MusicRepo_DB_IndexContext(@"C:\MusicRepoDB_index",
new MusicRepo_DBDataContext());
The following query returns a result: db.Artists.Where(a => a.Name == "Camel");
But this one doesn't: db.Artists.Where(a => a.Search("Camel"));
[Update]
Upon further testing, I realized that the Match
extension method does actually return a result, wheres as the other ones (Search
, Like
) don't. I'm still struggling with this issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也在我的项目中使用它,我相信这条消息显示“Lucene Term 的谓词不能是空字符串。”,因为 Lucene 不接受空术语作为搜索条件。
这就是我身上发生的事情:
(Northwind 数据库)
当我尝试搜索时,
它工作正常,但是当我尝试时:
它显示“Lucene 术语的谓词不能是空字符串。” 错误。
希望能帮助到你
I am using it in my project too and my belief is that this message shows up “The predicate of a Lucene Term can not be the empty string.”, because Lucene does not accept an empty term as a search criteria.
That's what happened to me:
(Northwind database)
When I tried to search
it works fine, but when I try:
it shows the “The predicate of a Lucene Term can not be the empty string.” error.
Hope it helps