Ayende, thanks for your answer. I've checked [ContainedIn] but its
meaning is to signals NH.Search that an associated object has changed
and need to be re-indexed.
Suppose we have the following relationship (pseudocode):
Order *------1 Customer
- 1st case: It does work:
class Order
string Number
[IndexEmbedded] Customer
class Customer
string Name
[ContainedIn] IList Orders
This works and the order index will contains also customer's fields
and you can search for _orders_ using customer fields (eg:
Customer.Name:whatever). Great!
- 2nd case: My use case is the opposite and doesn't work (Yes I know,
the use case is weird...)
class Customer
string Name
[IndexEmbedded] IList Orders
class Order
string Number
[ContainedIn???] Customer
In that case the customer index should contains order's fields and the
user can now do searches for _customers_ using order's fields
(eg:Orders.Number:A123).
The test EmbeddedTests.TestIndexedEmbeddedAndCollections() checks just
that but it's marked with [Ignore] (and fails, I've checked ;-))
This is a link to the relevant section of Hibernate.Search
documentation:
http://www.hibernate.org/hib_docs/search/reference/en/html/search-mapping.html#search-mapping-associated
Thanks again
Massimo
On Dec 23, 12:13 pm, "Ayende Rahien" <[email protected]> wrote:
> Hm, IIRC, it should put the child data in the parent.
>
> You might want to check ContainsIn
>
> On Tue, Dec 23, 2008 at 10:52 AM, iacoware <[email protected]> wrote:
>
> > Hello everyone,
> > I'm trying to use NHibernate.Search but I'm stuck on what seems a
> > major problem. NH.Search doesn't allow to embed in a lucene document
> > fields of associated entities with a relationship of 1-N (see
> > EmbeddedTests.TestIndexedEmbeddedAndCollections())
> > Let me try to better explain my situation. Suppose we've a parent-
> > child relationship.
>
> > ----------------- ---------------
> > | Parent | 1-----* | Child |
> > | -Number | | -Name |
> > ----------------- ---------------
>
> > In that case tipically you want _one_ lucene document with fields from
> > _both_ entities (Parent & Child) so you can query Parent entities
> > using child fields (childs.Name).
> > How do you have solved that problem? Is there a workaround? I'm a
> > newbie to NH.Search and maybe I've overlooked something and maybe
> > there is a simpler solution.
>
> > Thanks
> > Massimo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---