-->
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: Hibernate Search: indexing only some entities
PostPosted: Fri Apr 25, 2008 7:57 am 
Newbie

Joined: Mon Nov 06, 2006 6:19 pm
Posts: 16
Hello,

is it possible to index only some entities? The filtering that I need to make is based on non-indexed fields in a referenced entity.

I tried implementing my own hibernate.search.worker.backend, but the queue received there consists of values already translated to Lucene, without access to the original entity.

Is there any other way?

--
Regards,
Adam Warski


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 7:16 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
Quote:
is it possible to index only some entities?

It's going to index only the entities marked with @Indexed

Quote:
The filtering that I need to make is based on non-indexed fields in a referenced entity.

Make them indexed?
Did you see @IndexedEmbedded and @ContainedIn in the docs?

Sorry for the simplistic answer, I sincerely hope to have you given some ideas but I realize that most probably I didn't understand what your question is.

regards,

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 4:30 am 
Newbie

Joined: Mon Nov 06, 2006 6:19 pm
Posts: 16
Hello,

I have the entity marked with @Indexed, but what I wanted to achieve is to index only some instances, that is, only some rows in the table, basing on the value of some field.

Ideally, I'd like a filter deciding which instances of an entity are indexed, and which aren't.

--
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 4:58 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
thanks, now I understand.

It is currently not possible to completely skip the index-insertion on a per-instance logic, still a good workaround is to add an additional boolean field (e.g. Field(include:false), so you can filter on it when doing searches.

You may add a custom @ClassBridge, or you could add a method returning boolean marked with both @Transient and @Field;

So there's much flexibility in how you index and you could implement this behavior, only needing an additional field; The bad news is that your index will contain some unneeded data, the good news is that when you'll change your mind and will need the objects you left out it will be possible to search on them.

You may ask for it as a new feature but I'm not sure the maintainers will accept it: you'll have to convince them.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 5:09 am 
Newbie

Joined: Mon Nov 06, 2006 6:19 pm
Posts: 16
I see ... well, maybe @ClassBridge + an additional field is a good way out. Thanks for the help :)

Adam


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 27, 2008 5:50 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Adam,
I thought you may be interested in this:
http://opensource.atlassian.com/project ... HSEARCH-49

regards,

_________________
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.