-->
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] Selective embedded indexing based on parent ref
PostPosted: Tue May 19, 2009 2:14 am 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Hi all,
Quick question. I am indexing a parent class and embedding a child. The parent looks like:

Code:
@Indexed
class Parent {
  @IndexedEmbedded
  Child child;
  @IndexedEmbedded
  List<Child> children;
}


For simplicity lets say a Child looks like

Code:
class Child {
  @Field
  String a;
  @Field
  String b;
}


What I'd like to do is from the Parent index both child.a and child.b, but only index children.a and _not_ children.b. Any possible way to do this? (In practice I have _many_ more fields on the child and I only want the children link to index a couple whereas the child link indexes all of them.)

Thanks!


Top
 Profile  
 
 Post subject: Re: [Search] Selective embedded indexing based on parent ref
PostPosted: Tue May 19, 2009 3:38 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
What I'd like to do is from the Parent index both child.a and child.b, but only index children.a and _not_ children.b.

I'm sorry I don't understand in which case you want children.b.

Anyway in both cases I think you need a FieldBridge or ClassBridge annotation on the List<Child> children; instead of the IndexedEmbedded: you can code the field access yourself for this kind of flexibility.

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


Top
 Profile  
 
 Post subject: Re: [Search] Selective embedded indexing based on parent ref
PostPosted: Tue May 19, 2009 12:13 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Sorry if it was not clear. Child is connected to Parent in two places, via the child variable, and via the children list. I would like to index all properties of Child from the child variable, but for example only one property of the Child class from the children list. Using my above example one could imagine an IndexEmbedded tag that allows you to explicitly list the properties of the embedded object that you would like to index, ie:

Code:
@Indexed
class Parent {
  @IndexedEmbedded(index=("a","b"))
  Child child;
  @IndexedEmbedded(index=("a"))
  List<Child> children;
}


I think the field bridge may work, although I'm not really sure how it behaves for lists of objects. I think being able to explicitly list the properties you would like to index of child classes from the parent from the IndexedEmbedded or similar tag would be a great feature, and save tedious work creating FieldBridges.

Did that make sense?

Thanks!
David


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.