-->
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.  [ 4 posts ] 
Author Message
 Post subject: [Hibernate Search] Question regarding @IndexedEmbedded
PostPosted: Wed Aug 22, 2007 6:21 am 
Newbie

Joined: Wed Aug 22, 2007 5:37 am
Posts: 1
I'm using Hibernate Search 3.0.0 Beta 3 and i was wondering if something like the following is possible. I'm trying to do this but can't seem to make it work.
Code:
@Indexed(index = "classa")
Class A
{
   @IndexedEmbedded
    List<ClassB> bList;
}


@Indexed(index = "classb")
Class B
{
   @IndexedEmbedded
    List<ClassC> cList;
}

@Indexed(index = "classc")
Class C
{
   @Field(index = Index.TOKENIZED, store = Store.NO)
   String name;
}

then my query is something like:
bList.cList.name:xxx

Is this possible?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 22, 2007 10:07 pm 
Newbie

Joined: Mon Apr 23, 2007 6:57 pm
Posts: 12
BTW I'm using Beta4

From the document
Quote:
@IndexedEmbedded is supported on collections too (ie to index associated object included in collections).
But the support is only partially implemented. It will depend on how you update collections
(Check HSEARCH-56 in JIRA for more informations). The workaround is to manually index the object
(session.index())


But it does not work even without collections. In my case, fields from Class C objects are not added to Class A indices however I can access Class B fields. I thought the depth was defaulting to 1 so I defined depth=2 in Class A but still the same problem. I just want to have Class B and Class C as part of Class A index. Do I still need to add to @Indexed to Class B and Class C?

Code:
@Indexed
Class A
{
   @ManyToOne
   @IndexedEmbedded
    B bObject;
}


Class B
{
    @Field
     String name;

    @ManyToOne
    @IndexedEmbedded
     C cObject;
}


Class C
{
    @Field
    String name;

    @Field
    String title;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 22, 2007 10:33 pm 
Newbie

Joined: Mon Apr 23, 2007 6:57 pm
Posts: 12
It works after I make the following changes. I'm not sure if it would work for collections but you could try and post your results.

Ideally I would expect depth=2 in Class A to work but for some reason I have to define the depth in Class B. May be I don't understand the usage of depth.

To answer my other question, other classes(B &C ) need not have @Indexed.

Hope it helps others using hibernate search.
Code:
@Indexed
Class A
{
   @ManyToOne
   @IndexedEmbedded
    B bObject;
}


Class B
{
    @Field
     String name;

    @ManyToOne
    @IndexedEmbedded(depth=1) /*** Modified ***/
     C cObject;
}


Class C
{
    @Field
    String name;

    @Field
    String title;
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 2:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This might be a bug, can you post your test to JIRA, I need to check it out.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.