Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Question about related data
PostPosted: Wed Apr 11, 2012 2:27 am 
Newbie

Joined: Wed Apr 11, 2012 2:13 am
Posts: 1
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 Animals. Each animal has a field age and name. 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:
Code:
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:
Code:
(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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.