Lucene.Net.Linq
Lucene.Net.Linq copied to clipboard
Lazy field retrieval
Supposing a document like:
public class Book
{
public string Title { get; set; }
public string Author{ get; set; }
public string Text{ get; set; }
}
And a query like:
from b in books
where b.Title == "foo" || b.Author == "bar"
select new { b.Title, b.Author };
Lucene.Net.Linq should not retrieve large, possibly compressed fields like Text since the client is not using that field.
Out of curiosity, in raw Lucene, is there a performance benefit to not reading fields in a Document even though it's already been loaded from the index?
This would be a performance optimization that may only benefit certain use cases where a given field is very large or uses compression and won't be used. See [IndexReader.Document](https://lucene.apache.org/core/old_versioned_docs/versions/3_0_1/api/all/org/apache/lucene/index/IndexReader.html#document%28int, org.apache.lucene.document.FieldSelector%29).