Hi Mathieu, Then way I do this is by creating a class bridge. That way you can create and manipulate any field in the document ans you have access to your object.
Simon On Fri, Oct 16, 2009 at 5:34 AM, mathieu <[email protected]> wrote: > > Hello everyone, > > How could I index "all" fields of my classes to make searching them > easier ? > For example, I have the following class : > > [Indexed(Index="Index")] > public class MyEntity > { > [DocumentId] > public virtual long Id { get; set; } > > Field(Index.Tokenized, Store = Store.Yes)] > public virtual string Title { get; set; } > > [Field(Index.Tokenized, Store = Store.Yes)] > public virtual string Description { get; set; } > } > > I would like to index both Title and Description in an "AllFields" > Field, so when I want to search in any fields, I just query > "AllFields:something". It's easy to do directly in Lucene.Net, but I > can't find a way to do the same in NHibernate.Search. > > I've tried : > 1 - Putting an attribute [Field(Index.Tokenized, Store = Store.Yes, > Name="All")] on all fields that I want indexed that way, but > ScopedAnalyzer throws an exceptionon line 26 : scopedAnalyzers.Add > (scope, analyzer); > So i've added "if( !scopedAnalyzers.ContainsKey( scope ) )" just > before. But I don't like it very much... > 2 - Modifying DocumentBuilder.cs, line 392, by adding : > propertiesMetadata.fieldBridges[i].Set( > "AllFields", > value, > doc, > propertiesMetadata.fieldStore[i], > propertiesMetadata.fieldIndex[i], > GetBoost(member)); > But I don't like it very much neither... > > Anyone got an idea ? I "need" this "AllFields" Field so I can search > all my index, and return "all" Documents that match my query, > regardless of their fields or type. > > Thanks in advance, > Mathieu > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
