Note that there are some explanatory texts on larger screens.

plurals
  1. POLucene.NET indexes are not updating when dealing with many-to-many relationships using NHibernate.Search
    text
    copied!<p>I have integrated NHibernate.Search into my web app by following tutorials from the following sources:</p> <ul> <li><a href="http://blogs.intesoft.net/post/2008/03/NHibernateSearch-using-Lucene-NET-Full-Text-Index-Part1.aspx" rel="nofollow noreferrer">NHibernate.Search using Lucene.NET Full Text Index (Part 1)</a></li> <li><a href="http://using.castleproject.org/display/AR/Using+NHibernate.Search+with+ActiveRecord" rel="nofollow noreferrer">Using NHibernate.Search with ActiveRecord</a></li> </ul> <p>I have also successfully batch-indexed my database, and when testing against Luke, I can search for terms that reside in whatever entities I marked as indexable. </p> <p><strong>However</strong>, when I attempt to update many-to-many entities via my web app, my parent index does not seem to update. For example:</p> <pre><code>public class Books { HasAndBelongsToMany(typeof(Author), Table = "BookAuthor", ColumnKey = "BookId", ColumnRef = "AuthorId")] [IndexedEmbedded] public IList&lt;Author&gt; Authors { get { return authors; } set { authors = value; } } } public class Author { HasAndBelongsToMany(typeof(Book), Table = "BookAuthor", ColumnKey = "AuthorId", ColumnRef = "BookId"), Inverse=true] [ContainedIn] public IList&lt;Author&gt; Authors { get { return authors; } set { authors = value; } } } </code></pre> <p>Now, when I try to do things like <code>myBook.Authors.Add(Author.Create("xxx"))</code> I can see that my Author index has been updated, however, the Book index (which is the parent index) has not been updated and searching for the newly added author returns an empty result. </p> <p>Note that this only happens when dealing with many-to-many relationships. </p> <p>I am not sure why this is so. Has anyone else experienced similar difficulties? I'd appreciate it if I could be pointed in the right direction, cheers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload