This project is read-only.

Custom attribute reader

Nov 13, 2009 at 6:37 PM
Edited Nov 13, 2009 at 6:38 PM


First thanx for this great project!

I would like to use custom attribute readers with Linq to Lucene. So, I made some small changes in the source code. One of the adjustments i made is to make the AttributeReader class non static and added an IAttributeReader interface.

By passing the IAttributeReader through the constructors it is possible to use a custom attribute reader which maps the documents/fields.  When not specified fallback on the default attribute reader.

For example :

var xmlAttributeReader = new XmlAttributeReader();
var customBehaviourIsetDir = new IndexSet(dir, xmlAttributeReader); // use custom reader for mapping

var defaultBehaviourtIsetDir= new IndexSet(dir); // using default AttributeReader

Fits an custom IAttributeReader within the future plans for Linq to Lucene?

Nov 22, 2009 at 11:36 AM

Fits an custom IAttributeReader within the future plans for Linq to Lucene?

Nov 22, 2009 at 8:09 PM



looks good!


sorry, out of the country atm. will look at all these things when i get back in the next week

Nov 29, 2009 at 2:15 PM
Edited Nov 29, 2009 at 2:16 PM


I am trying to make a working proof at the moment. :-) At the same time learning about linq providers etc.

At the moment i am figuring out why an object  the case with the xml mapping not gets filled. And learn about projections and stuff.

I am stucked at :

When using attribute mapping, i get back an object 'User' with a filled username.

When using the xml mapping, i get back an object 'User' with an empty username.

I am searchin what is happening :-) Especially debugging is a worm in the fruit!


Dec 2, 2009 at 10:40 PM
Edited Dec 2, 2009 at 10:41 PM

After some deepdiving into linq provider stuff, the problem was with the custom xml mapping! The fieldStore wasnt set.

I got search results. I think I have a working proof. If no big messy errors will occur further i can say it wasnt a big job and not a lot code to refactor.

I still hope custom mapping will be integrate into linq to lucene. Nice examples for XML mapping are provided by Matt Warren with the latest version of IQToolkit.