Some little feature requests

Jul 27, 2011 at 3:42 PM

1. Is there a sort and pagination support for SimpleLucene? such as SearchService's Search(Query query, Sort sort, int start, int limit);

2. As the IResultDefinnition only takes a Convert method, why not make a method like Search(Query query, Func<Document, T> converter) like the IndexEntity method?

Jul 27, 2011 at 4:05 PM

Please can you add feature requests via the Issue tracker.

1. Not currently. You can sort and page the results after you've received them from the Lucene index, but not directly.

2. To be honest I wish I hadn't included the delegate version of IndexEntity as I think it's better to have separate index definitions. I'll consider it for searching. In the meantime, you can use the DynamicSearchResultDefinition found in the test project:


    public class DynamicSearchResultDefinition<T> : IResultDefinition<T>
        private readonly Func<Document, T> converter;
        public DynamicSearchResultDefinition(Func<Document, T> converter)
            this.converter = converter;
        public T Convert(Document document)
            return converter(document);


Feb 13, 2012 at 1:48 PM

The latest release includes an extension method to ISearchService that accepts a delegate result definition e.g:

            var products = searchService.SearchIndex(
                new TermQuery(new Term("id", "1")),
                doc => {
                    return new Product { Name = doc.GetValue("name") };