Hi, I'm new to the world of Hibernate Search and I was wondering if the following is possible.
I have a class Person
and inside is a list of Animal
s. Each animal has a field age
. Now I'm indexing both classes and above the list of animals I put an annotation @IndexedEmbedded
. The result is a document Person with the following:
animals.animal.name = Bob
animals.animal.age = 10
animals.animal.name = Fred
animals.animal.age = 5
(Bob is 10 years old and Fred is 5 years old)
My question is if I can somehow still determine how data are related to each other? If I use a query like this:
(animals.animal.name:Bob AND animals.animal.age:10) AND (animals.animal.name:Fred AND animals.animal.age:5)
it will return the document I entered above, but it will also return a document with someone having an animal named Bob being 5 years old and Fred being 10 years old (age switched) and that is not what I'm looking for.
So my question is, is it possible to keep data together in documents?