-->
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: concat 2 field and index it
PostPosted: Wed Nov 23, 2011 7:15 am 
Newbie

Joined: Wed Nov 23, 2011 7:06 am
Posts: 1
hi , i have entity that contains 3 fields : firstname, lastname, fathername. i want indexing concatenation of firstname and lastname.but i can't find solution for done this work with annotation on hibernate search.


Top
 Profile  
 
 Post subject: Re: concat 2 field and index it
PostPosted: Thu Nov 24, 2011 7:13 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

can you explain what you want to do and why. What is your usecase? If you need custom fields in the index you might want to consider a ClassBridge. There you have access to the full entity and Lucene Document. You can add whatever fields you want.

--Hardy


Top
 Profile  
 
 Post subject: Re: concat 2 field and index it
PostPosted: Fri Nov 25, 2011 7:08 am 
Newbie

Joined: Wed Sep 21, 2011 2:20 pm
Posts: 16
if my understandig of your question is correct, then the answer is very simple

you write a method in which you concatenate the two field and annotate this method (and not the two distinct fields) e.g.

@Field
public String getFullName(){
return firstname + " " + lastname;
}

is this what you are looking for?

regards


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.