-->
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.  [ 6 posts ] 
Author Message
 Post subject: I need help with a mapping (@IndexedEmbedded & @ContainedIn)
PostPosted: Fri Mar 02, 2012 7:00 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Hello,

I'm doing a searcher with Hibernate Search and I need to solve one question.

I have a main class: XxsgcExperts

Code:
@Indexed
public class XxsgcExperts implements java.io.Serializable {

   @DocumentId
   private BigDecimal idExperto;
   @ContainedIn
   private Set xxsgcPublicacioneses = new HashSet(0);
   @Field(index = Index.TOKENIZED, store = Store.NO)
   private String nombre;
   .....
   (rest o the bean)
}


that has some relactions as the next:

Code:
<set name="xxsgcPublicacioneses" table="XXSGC_PUBLICACIONES" inverse="true" lazy="true" fetch="select">
   <key>
      <column name="ID_EXPERTO" precision="22" scale="0" not-null="true" />
   </key>
   <one-to-many class="es.il3.sigec.model.beans.XxsgcPublicaciones" />
</set>


and the class XxsgcPublicaciones is here:

Code:
@Indexed
public class XxsgcPublicaciones implements java.io.Serializable {

   @DocumentId
   private BigDecimal idPublicacion;

   @IndexedEmbedded
   private XxsgcExperts xxsgcExperts;
   .....
   @Field(index = Index.TOKENIZED, store = Store.NO)
   private String tituloEs;
   @Field(index = Index.TOKENIZED, store = Store.NO)
   private String tituloCa;
}


I launch the indexer over XxsgcExperts and XxsgcPublicaciones and all it's ok, but I need do something that I don't know if it's possible.
I'd like to search from the XxsgcExperts to the fields of XxsgcExperts and XxsgcPublicaciones. This is, I need do something who

Code:
final MultiFieldQueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30,"nombre,xxsgcPublicacioneses.tituloEs ", analyzer);



I've seen that with Luke, from XxsgcPublicaciones, you could search on XxsgcExperts fields, but I have to do the opposite and do not know if possible.

Thanks a lot and sorry for my english!!


Last edited by markosca on Fri Mar 09, 2012 6:47 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: I need help with a mapping
PostPosted: Sun Mar 04, 2012 3:53 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
I've seen that with Luke, from XxsgcPublicaciones, you could search on XxsgcExperts fields, but I have to do the opposite and do not know if possible.

Hi,
you have to change the mapping a bit: The indexed Document will containe the fields from the indexed entity + all fields following an @IndexedEmbedded. So just ass an @IndexedEmbedded annotation for the fields you want to add.

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


Top
 Profile  
 
 Post subject: Re: I need help with a mapping
PostPosted: Mon Mar 05, 2012 5:17 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Hi,

I've tried with this code and doesn't works (Luke doesn't show XxsgcPublicaciones fields). Also, the indexing process has been slow to finish.

Code:
@Indexed
public class XxsgcExperts implements java.io.Serializable {

   @DocumentId
   private BigDecimal idExperto;
   @IndexedEmbedded
   private Set xxsgcPublicacioneses = new HashSet(0);
        ...


Thanks.


Top
 Profile  
 
 Post subject: Re: I need help with a mapping
PostPosted: Wed Mar 07, 2012 3:51 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Any idea??


Top
 Profile  
 
 Post subject: Re: I need help with a mapping (@IndexedEmbedded & @ContainedIn)
PostPosted: Fri Mar 09, 2012 6:46 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
I´ve tried similar options as said in this page

viewtopic.php?p=2368543

but although the indexer takes such long time to do the process, the result is the same.

I can't believe that Hibernate can't do indexing with these options, although I imagine I'm doing something wrong and would be helpful for someone to help me.

Thanks a lot!


Top
 Profile  
 
 Post subject: Re: I need help with a mapping (@IndexedEmbedded & @ContainedIn)
PostPosted: Tue Mar 20, 2012 4:26 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
there must be something wrong in some detail. It would really help if you could provide a working unit test I could look into. Please don't share a large project, just a functional tests.

There are examples of tests in our code base, have a look into existing tests at https://github.com/hibernate/hibernate-search

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


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