Yoann. B
Yoann. B

Reputation: 11143

NHibernate.Search Index Rebuild

How can i rebuild Lucene.NET Index using NHibernate.Search ?

Thanks.

Upvotes: 2

Views: 814

Answers (2)

Shailen Sukul
Shailen Sukul

Reputation: 510

Here is an example:

    public void Index(List<object> entities, ISession s)
    {
        using (var search = NHibernate.Search.Search.CreateFullTextSession(s))
        {
            foreach (var entity in entities)
            {
                using (var tx = s.BeginTransaction())
                {
                    search.Index(entity);
                    tx.Commit();
                }

            }
        }

Upvotes: 1

Andrew Smith
Andrew Smith

Reputation: 1652

There is an Index method off of the IFullTextSearchSession that will force and index of an entity. So you just need to retrieve all of the objects and then call index on them.

Upvotes: 3

Related Questions