-->
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.  [ 7 posts ] 
Author Message
 Post subject: Create indexes on demand
PostPosted: Tue Aug 02, 2011 7:48 am 
Newbie

Joined: Tue Aug 02, 2011 7:35 am
Posts: 4
Hello,

I've a CMS system based in Lucene engine. We have several repository kind (photograph, video, audio, text, etc). Each one has differents fields to be indexed.
The administrator can create new repositories and the CMS creates new indexes on demand for the new repositories. And the users can insert documents and searchs for them.
I try to figure how can I create index on demand with Hibernate Search. I dive into documentation, books and tutorials and I can't to find anything about this feature.

Can anyone help me?


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Tue Aug 02, 2011 12:42 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hibernate Search will automatically start and create needed indexes when it starts.

Are each of these "CMS repositories" handled by a different Hibernate SessionFactory? If so, you don't need to do anything.

If you want to use a single SessionFactory and use sharding for the indexes, then you need dynamic sharding and that's not implemented yet, it will likely be available in Hibernate Search v.4.0 (next release).

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


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Tue Aug 02, 2011 12:43 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
link to the JIRA issue: https://hibernate.onjira.com/browse/HSEARCH-472

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


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Wed Aug 03, 2011 3:32 am 
Newbie

Joined: Tue Aug 02, 2011 7:35 am
Posts: 4
I think I have not explained well ...

When the administrator creates a new repository, the CMS creates a new index "on the fly" not when the system starts. Regardless of another indexes of the same class exists, for each new repository a new index is created. Also, when the user searches for in a repository, the CMS searchs in the index associated, not in all indexes.

I've not seen would be possible do that with Hibernate Search because, as you said, the indexes are created in start time and the same class is associated with only one index.

For example, there are three photograph repositories, A, B and C. The document class (PhotographBean.java) is the same for them. The system creates three differents indexes, each one with its documents.

This architecture gives us several adventages, one of this is when the index is corrupted and its must be reindexed. The system only reconstruct this one, not a big index with about 2 million of documents.

The user can works with the other repositories, meanwhile the corrupted is reindexed.

Is there any manner to replicate this architecture with Hibernate Search?


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Wed Aug 03, 2011 5:01 am 
Newbie

Joined: Tue Aug 02, 2011 7:35 am
Posts: 4
Follow with my example...

Could be possible create classes "on-the-fly" with BCEL o similar package?

I mean... create subclasses PhotographBeanA.java, PhotographBeanB.java, PhotographBeanC.java inherited from PhotographBean.java with
@Indexed(name="A"), Indexed(name="B"), @Indexed(name="C") for each class and restart (in run-time) SessionFactory o EntityFactory in order to HSearch creates the new indexes.

What do you think about this solution?

All of this, with the added problem our system is clustered ;)


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Wed Aug 03, 2011 5:27 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
you don't need BCEL, it can be much simpler.
Why can't you start a new instance of Hibernate Search when "the administrator creates a new repository", "on the fly" as you wrote. that's one option, likely the simplest one.

Another option is you use Sharding, use a single PhotographBean class and filter on shards. The only complexity here is that sharding is not dynamic, but you can stop the SearchFactory and start a new one.

Also consider you can use the programmatic configuration API, indexes don't need to be defined via annotations.

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


Top
 Profile  
 
 Post subject: Re: Create indexes on demand
PostPosted: Wed Aug 03, 2011 2:59 pm 
Newbie

Joined: Tue Aug 02, 2011 7:35 am
Posts: 4
I've seen Programmatic API and it seems to adjust more to my needs.

Thanks a lot.


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