Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Restricting fields with @indexedEmbedded / includePaths
PostPosted: Wed Mar 16, 2016 6:04 am 
Newbie

Joined: Wed Mar 16, 2016 5:51 am
Posts: 3
Hello,

I'm trying to restrict the fields indexed in a relation, it should be easy reading the doc.

Here's the model:

Code:
@Indexed
public class Client {
    @IndexedEmbedded
    private ProfessionnelGC professionnelGC;
}

Code:
@Indexed
public class ProfessionnelGC implements Serializable {
    @IndexedEmbedded(includePaths = { "raisonSociale" })
    private Groupe groupe;
}

Code:

@Indexed
public class Groupe  {

    @Field
    private String numeroContrat;

    @Field
    private String sapId;

    @Field
    private String raisonSociale;

}


I'd like to index only the "raisonSociale" field when indexing the parent (Client/ProfessionnelGC) entity, if i understood i should only have to give the name of the field (without prefix) in the includePaths annotation value, but it doesn't work.
If i don't use includePaths every sub field will be indexed, but as soon as i use includePaths nothing from the Groupe entity is indexed.
I tried every includePaths syntax (with or without part/full prefix etc), playing with prefix annotation value, no result.

If anybody can help, thanks a lot!


Top
 Profile  
 
 Post subject: Re: Restricting fields with @indexedEmbedded / includePaths
PostPosted: Tue Mar 29, 2016 4:28 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 386
Hey,

I think you hit a bug there which shows up when it comes to multi-level hierarchies using @IndexedEmbedded. I've filed https://hibernate.atlassian.net/browse/HSEARCH-2194 for tracking it.

As a work-around you could specify just @IndexedEmbedded for ProfessionnelGC#groupe (that is, if you can live with all Groupe fields being added to the index of ProfessionnelGC) and then @IndexedEmbedded(includePaths = { "groupe.raisonSociale" }) on Client#professionalGC.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: Restricting fields with @indexedEmbedded / includePaths
PostPosted: Wed Mar 30, 2016 10:03 am 
Newbie

Joined: Wed Mar 16, 2016 5:51 am
Posts: 3
Thanks for the reply, right now i'm dealing with it by using non indexed AND non stored fields on solr.
Solr Schema is a bit polluted by those "ghosts" fields, and the data sent to solr is bigger than needed because of them but that's ok while waiting for a fix :)


Top
 Profile  
 
 Post subject: Re: Restricting fields with @indexedEmbedded / includePaths
PostPosted: Wed Mar 30, 2016 11:09 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Could you explain how Solr is integrated?

We have Solr support on our wishlist, but didn't implement it yet :)

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


Top
 Profile  
 
 Post subject: Re: Restricting fields with @indexedEmbedded / includePaths
PostPosted: Wed Mar 30, 2016 11:19 am 
Newbie

Joined: Wed Mar 16, 2016 5:51 am
Posts: 3
With a custom BackendQueueProcessor implementation, using a basic HttpSolrServer instance (solrJ).
Started from this exemple, and made some cleanup/changes to use a newer solrJ version (4.1x needed for better pivot fields integration) and our specific needs.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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.