Search code examples
nhibernatenhibernate-search

NHibernate Search without attributes


Is there any NHibernate Search library which doesn't require attributes on your entity properties?

I'd like to keep my entities as clean POCOs, so perhaps there is a fluent interface?

If not, perhaps I'll write one!

Thanks


Solution

  • Woow old question, but maybe it should help.

    I've just started a Fluent NHibernate.Search mapping interface similar to FluentNHibarnate, which allow you to map your entities without attributes.

    public class BookSearchMap : DocumentMap<Book>
    {
        public BookSearchMap()
        {
            Id(p => p.BookId).Field("BookId").Bridge().Guid();
            Name("Book");
            Boost(500);
            Analyzer<StandardAnalyzer>();
    
            Map(x => x.Title)
                .Analyzer<StandardAnalyzer>()
                .Boost(500);
    
            Map(x => x.Description)
                .Boost(500)
                .Name("Description")
                .Store().Yes()
                .Index().Tokenized();
        }
    }
    

    You should take a look on the project site hosted on codeplex.

    http://fnhsearch.codeplex.com/