-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: [Search] How do I index @CollectionOfElements List<String
PostPosted: Thu Mar 26, 2009 11:17 pm 
Newbie

Joined: Tue Mar 17, 2009 8:16 pm
Posts: 2
Location: Melbourne, Australia
Hey all,

I have the following in my 'Patient' class:

@CollectionOfElements
private List<String> address;

Which just stores an array of strings as an Address for a patient.

How can I make it so that Hibernate Search will index this data?

I've tried:
@CollectionOfElements
@IndexedEmbedded(depth=1)
private List<String> address;

Using Luke (http://www.getopt.org/luke/), I can see that the address is not in the field list.

I can't seem to find any documentation on how to do this, so any help would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 28, 2009 7:36 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
you'll have to annotate your address field with a

Code:
@FieldBridge


see http://www.hibernate.org/hib_docs/search/reference/en/html_single/#d0e2321 for more details;

You need to define how you would like to have all this Strings share the same field; in most cases you will just append all String components and return the appended String.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 28, 2009 7:45 pm 
Newbie

Joined: Tue Mar 17, 2009 8:16 pm
Posts: 2
Location: Melbourne, Australia
Thanks for that!

I ended up writing getSearch*() methods that returned the data I needed to get indexed, but I can see how this would be a better approach, and marking them as @Transient and @Field, and that worked well.

Unfortunately I'm on a tight deadline, so I won't have time to get into this now, but I'll keep this in mind for future work.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.