-->
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.  [ 13 posts ] 
Author Message
 Post subject: Hibernate Search and GigaSpaces support
PostPosted: Tue Sep 23, 2008 4:02 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi

I'm not sure whether this question belongs here or at GigaSpaces forum, are there any directory providers that can be used within GigaSpaces? For example Compass provides a GigaSpaces directory provider for maintiaining indexes in the Space.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 9:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you definitely should also ask this question at the GigaSpaces forum. I personally did not even know this product. It seems to be a app server of sorts, right?

Currently there is no GigaSpace secific directory provider in Hibernate Search which does not mean that one couldn't create one. Directory providers are pluggable. I guess the first step is understanding what is required from a GigaSpace 'enabled' directory.

In case you want to give it a go make sure to let s know about your progress. We can also help with genric hints on how to write and integrate your directory provider.


--Hardy


Top
 Profile  
 
 Post subject: GigaSpaces and Hibernate Search
PostPosted: Wed Sep 24, 2008 2:36 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi

GigaSpaces is a commercial implemntation of the JavaSpaces API. Basically what I need to do is build a provider that will put indexes into the Space (with take/read/write operations)...I will have a go at doing the provider and might be back for help!


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 26, 2008 3:40 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi there,

I have on first pass created a class that implements Lucenes Directory interface for maintaining indexes in the Space (GigaSpaces). I have some unit tests and also integration tests whereby docuements are added to the space using IndexWriter and searched using IndexSearcher.

I am now ready to plug the directory provider into Hibernate Search however I am somewhat stuck. There is a DirectoryProvider class which I need to implement (initialise and start exposed methods) but I'm not sure what I need to do in tehm. Would be possible if someone could please advise me on what needs to happen.


Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 4:46 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
take a look at org.hibernate.search.store.RAMDirectoryProvider
and org.hibernate.search.store.FSDirectoryProvider
they are quite simple.

Code:
void initialize(String directoryProviderName, Properties properties, SearchFactoryImplementor searchFactoryImplementor);

you don't need to do anything special here, but it makes sense to use the parameters to configure you implementation. the properties is containing the hibernate search configuration value-pairs so you can add some keywords in your persistence.xml
The name is useful for logging messages or recognize the instance during debug, I usually just save it in a field.
searchFactoryImplementor is usually not needed, but you could need it to access some more information.

Code:
void start()

this is a good place to put any heavy weight initialization, like starting background threads. Again you may just leave the method empty if you don't need to do anything. You could do it all in initialize, but usually you should just configure yourself there.

Code:
void stop()

If you have to cleanup something or stop helper threads, do it here..
(again you're not required to do anything at all)

Code:
TDirectory getDirectory();

Just return the directory you built; this is the factory method.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 4:54 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I nearly forgot:
it is very important you override equals() and hashcode() to guarantee you don't have more instances which are "different" but use the same underlying Directory.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 3:05 pm 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Thanks for your reply. I have got my Directory provider working however I am currently hard coding the url of the space in the start method. You mentioned that I can use Properties which can be configured in the cfg.xml file, however I am not sure how to do this. Whenever I debug my directory provider I can see the properties variable as empty.

The other point is that I am using Spring to wire my sessionfactory and setting the directory provider in the properties field. However I did not want my GigaSpacesDirectoryProvider to be spring injected.


Any help would be highly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 3:48 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
it is working like other DirectoryProviders, imagine you are configuring a standard one as documented here:
http://www.hibernate.org/hib_docs/search/reference/en/html_single/#search-configuration-directory

Only the relevant properties for your DirectoryProvider are provided to it, so if you have a configuration file containing:

Code:
hibernate.search.NAME.directory_provider your.own.ImpleMenTation
hibernate.search.NAME.XYZ yourUrl


you will get a property with key XYZ and value yourUrl

NAME can be any index name, or "default" meaning you want your implementation for all indexes.

You should read the book.. it's advertised on the banners on this same forum;
it's full of this sort of tips and explains how to best implement any sort of extensions.

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 3:43 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Thanks for your reply. I have got it working now. I have also purchased the eBook of Hibernate Search in Action and at first glance it looks good.


Thanks again for your help


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 5:34 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
nice; If you see some glitches in the book or stuff you think could be improved,
please let us know asap as these are the last days we can still fix something.

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


Top
 Profile  
 
 Post subject: Hibernate in Action
PostPosted: Wed Oct 01, 2008 2:18 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
hi

The thing that I was really interested in was the highlighting part of the book. However the example showed the use of a single field however if someone uses multiple fields to search on then it doesn't give you a clear idea on how you go about doing something like that. I'm not sure this is possible to include. Otherwise nothing major stands out. I'm glad it has been released as manning early access as my next project is using Hibernate Search.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 3:06 pm 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi

I have on first pass completed the GigaSpacesDirectoryProvider for Hibernate Search.

I would be very interested in getting feedback on the stuff that I have done but I am not sure where to post the code (whether Hibernate Search or GigaSpaces).

The aim is to build a distributed Search using Hibernate Search and GigaSpaces so that is the reason for doing this project. I'm not sure if I have missed anything from the directory provider therefore any input would be appreciated.


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2008 3:34 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

great that you could get things working :)

You might want to post your code both on the Hibernate Forum and the GigaSpaces one. I am sure we can give some generic feedback regarding the directory provider implementation and it is always good to hear about more successful integrations. You might consider adding a wiki page to the Hibernate Search Wiki area - http://hibernate.org/420.html - summarizing your solution.

By posting on the GigaSpaces forum you probably increase your chances of finding some people who can try your integration in a running system.

Good stuff,
--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.