-->
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: Migrating from Compass: @SearchableReference equivalent?
PostPosted: Tue Jan 15, 2013 10:21 am 
Newbie

Joined: Tue Jan 15, 2013 9:56 am
Posts: 7
I have a project that is currently using Compass. But as Compass is dead and falls further behind Lucene I'd like to possibly switch over to Hibernate Search. We're using Hibernate as our ORM, may as well use Hibernate's provided Lucene integration.

Compass has the @SearchableReference annotation. It puts into the index the id of the associated object, but not any of the object's field values.

Is there a way to do the same thing with Hibernate Search? We have some instances where we're using the associated object IDs.

I suppose I could use @IndexedEmbedded and only have @DocumentId on the associated object, but that doesn't seem right. Or could I use @Field with a bridge that pulls the id out of the associated object? Would work with ToMany associations?

Suggestions?


Top
 Profile  
 
 Post subject: Re: Migrating from Compass: @SearchableReference equivalent?
PostPosted: Fri Jan 18, 2013 9:43 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
I didn't know about @SearchableReference, and no there isn't a similar feature in Hibernate Search. I think you might trick the system by using a @ClassBridge (?)

Could you describe the use case? find it quite puzzling.

To be fair I never did a full comparison vs. Compass, it would be great if you could list any other gaps you find in your migration: maybe we can implement some or compile a guide for more people looking forward to move on.

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


Top
 Profile  
 
 Post subject: Re: Migrating from Compass: @SearchableReference equivalent?
PostPosted: Fri Jan 18, 2013 12:31 pm 
Newbie

Joined: Tue Jan 15, 2013 9:56 am
Posts: 7
sanne.grinovero wrote:
Could you describe the use case? find it quite puzzling.


The use case is Bar may be a large, complex object. When I search Foo, I want to filter on the associated Bars - not the values within the Bars, but which ones are attached to Foo. And I don't want to pull all the fields from Bar up into Foo's index. In our user interface, we do this with a select menu; the user selects one or more Bars and their IDs get added to the Lucene query against the Foo object. Make sense?

@SearchableReference is very much like @IndexedEmbedded, except the only field that gets embedded is the @DocumentId.

Now that I've read the Hibernate Search documentation a bit more, I think using @IndexedEmbedded(includePaths ={"id"}) would do the same thing as @SearchableReference. Unfortunately, "includePaths" is new with Hibernate Search 4, and we're still using Hibernate 3.

- Jasen.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.