This project is read-only.

How to index part of the table using LINQ to Lucene

Jul 26, 2009 at 12:01 AM


I am now using the following code to index the database.

var dbi = new DatabaseIndexSet<DataContext>(
                new DataContext());


My problem is, the above code will index all the tables in the DataContext, but sometimes I only need to index part of the contents of one table. Anyone here knows how to do this?

Thank you!

Jul 27, 2009 at 9:52 AM

DbIndexSet derives form IndexSet which is just a collection of Indexes. So you can access the Index object you want from DbIndexSet


var myidx = dbi.Get<MyDbItem>();

Then you can just add an IEnumerble<MyDbItem> into the index as such

var items = from i in dbContext.MyDbItem where i.Blah>12 select i;



Too easy :)