views:

574

answers:

2

This is getting quite annoying. Trying to integrate Lucene.Net search with NHibernate and i found only some information from year 07.

Is there a nice up to date tutorial for this? Where to start, what to download etc.?

Is there a way how to set NHibernate.Search metadata elsewhere and not on domain objects using attributes (i don't want to reference any nhibernate related stuff in my Core project)?

+3  A: 

I wrote a short tutorial on this, http://jwbs-blog.blogspot.com/2009/03/quickstart-guide-for-nhibernatesearch.html

I have no answer on your second question. There is a book on Hibernate.Search, consider reading that book. http://www.manning.com/bernard/

Jan Willem B
Didn't get it to work...
Arnis L.
At least - not how i want it to.
Arnis L.
what is the problem you run into?
Jan Willem B
I don't remember at the moment. Something with configuration. Newest version had something differently. Probably, nothing extra hard. I just didn't want it enough because of 2nd question. I'll check it once more when i'll be at home.
Arnis L.
OK. The compiled dll's are compiled to a previous version of NHibernate (not 2.1). You should compile nh.s yourself for the latest version.Good luck with it and with the answer on the second question (would be nice if that could be done).
Jan Willem B
Managed to get it up and running. Now i'm waiting and hoping on Andrey. Thanks. :)
Arnis L.
+1  A: 

Is there a way how to set NHibernate.Search metadata elsewhere and not on domain objects using attributes (i don't want to reference any nhibernate related stuff in my Core project)?

Working on it, please wait (hopefully) a day or two.

Update 1: Done, submitted patch to NHSearch JIRA.

Update 2: This is now in svn trunk (discussion).

Update 3: Added small post on how to make your own mappings.

Andrey Shchekin
I tried to work on that too. Somehow drop it. Will be interesting to see your implementation. Good luck. :)
Arnis L.
I have finished a trivial solution some days ago (just wrapped AttributeUtil in an ISearchMapping abstraction). I can send you a patch, but I do not like this solution at all, doing any kind of alternative ISearchMapping would be very tedious and unnatural with this approach.So now I am trying to rewrite it in a more structured way (basically build class/property metadata as an object), and this requires more time.
Andrey Shchekin
Just keep in touch. Give a sign when it's finished.
Arnis L.
Submitted patch to JIRA, see update above.
Andrey Shchekin
Patch accepted into repository.
Andrey Shchekin
Thanks a lot. Will check out. One last question - is it possible to create multiple indexes from one property using specified custom logic?
Arnis L.
Yes, there is no more property dependency at all. All FieldMappings have a NHibernate IGetter which can be property, .net field, or custom logic. You can reuse the same IGetter in any number of FieldMappings.
Andrey Shchekin
Checked out your work for a moment and couldn't understand how exactly it's supposed to be used (i have close to zero knowledge about nhibernate/nhibernate.search source code inner workings). Tiny tutorial would be appreciated. :)
Arnis L.
Sure, here you go: http://blog.ashmind.com/index.php/2009/10/26/custom-mapping-for-nhibernate-search/
Andrey Shchekin
Any index sync tips? Got requirement to import some bunch of data and reindex lucene indexes. Kind a stuck. :) (btw, no ideas why i can't accept any answer for this question).
Arnis L.