views:

436

answers:

1

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

+1  A: 

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

var mmCustomers = from c in dbi.Get<Customer>()
                      where c.ContactTitle == "Marketing Manager"                       
                      select c;

it works fine, but when I try:

var mmCustomers = from c in dbi.Get<Customer>()                       
                      select c;

it shows the “The predicate of a Lucene Term can not be the empty string.” error.

Hope it helps

Daniel Makiyama