-->
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: Using Postgres + Hibernate ?
PostPosted: Tue Jan 06, 2009 7:35 am 
Newbie

Joined: Tue Jan 06, 2009 7:29 am
Posts: 3
I am curious about if I would let my fulltext search be handled by Postgres (additional features), and let that return the id of each matched row.Then use HQL to match against the rest and fetch using :

select .... where id in {returned ids from postgres search}

Will that put an additional overhead to have HQL do an additional search on returned id's (matches) from the fulltext search ? Is it terrible to do so? Is it comparable to imagining HQL do both at the same time ? Basically, all I am asking HQL to do is match against the ids returned (1-50 (max 200) )

Is this a good approach? Bad? Why?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 4:48 pm 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
I didn't now that there was full text search support in Postgres. To be honest in my own opinion, I would just use Hibernate Search to do the search and it return the results. I don't see the point of doing search using postgres and then doing a HQL.


Top
 Profile  
 
 Post subject: hmm..
PostPosted: Tue Jan 06, 2009 5:59 pm 
Newbie

Joined: Tue Jan 06, 2009 7:29 am
Posts: 3
Yes, postgres has a built in fulltext support. Its pretty good to. Supports all kind of things.

But, I have yet to decide my search platform. Is hibernate search hard to learn? Hard to get started with ? Please be honest. The documentation is a little big and still in my opinion not very detailed from the look I gave it.

Is it possible to search through deep relations with and without fulltext search ? Mix HQL normal queries with fulltext in the same query ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2009 8:16 am 
Hibernate Team
Hibernate Team

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

I would recommend against using a mixed approach. In fact I am not even sure how you would achieve a useful combination.

Which feature do you think postgres fulltext search can offer which Hibernate Search cannot? I think this would be a good start for a discussion. If you describe what your requirements are and what you expect from your fulltext search it would be easier to say whether Hibernate Search is for you or not.

Regarding the time to get started, I would argue if you are use Hibernate it will be easier to learn Hibernate Search than the postgres specific functionality. In the end Hibernate Search is just an extension to the Hibernate Core adding Lucene into the mix. Another benefit is that everything is in Java, compared to additional postgres configuration.

Regarding relations - you can search them. First you index them via @IndexedEmbedded and then you can search the indexed properties via Lucene queries using bean property notation. Using Hibernate Search you won't write HQL queries to search the index, but rather Lucene queries.

Last but not least, I don't believe the online documentation is overly long. You can get started with the tutorial to get just the basics, but with anything else if you want to use some more advanced features you will have to read and try them.

Hope this helps,
--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 08, 2009 1:55 pm 
Newbie

Joined: Tue Jan 06, 2009 7:29 am
Posts: 3
Indeed, it is a good start of discussion.

To be honest I would prefer Hibernate Search but the reference is in my opinion blurry and leaves to many questions and I am kind of a perfectionist and need to know how and what stuff is. I got scared and choose postgres which honestly is VERY easy to use + that their reference is very explanatory. They even explain how things work in the background and the functionalities in depth, right there, on the same place it was mentioned, even on things one might agree has nothing to do with postgres necessarily such all the different types of dictionaries, what they are, do etc.

http://www.postgresql.org/docs/8.3/inte ... earch.html

This is just a hint that if one person thinks so, then probably more does and I obviously have no problem reading and understanding postgres reference on how to get started so Hibernate search is either harder to use or the reference is not AS well written as theirs. I think generally that hibernate reference is to splitted and in too many places. But it might just be me :)

Quote:
I would recommend against using a mixed approach. In fact I am not even sure how you would achieve a useful combination.


I was thinking of searching my text with postgres first. Getting the ids wich is a very easy query.
And then use HQL / Criteria to match against all other fields in where the ids are the same as the ones returned by fulltext search.. not good ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 4:01 am 
Pro
Pro

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

Just to put my 2 cents:

Hibernate Search is really easy to get started. It took me a few days to get it working, the online documentation is also very good (not to mention Hibernate Search In Action). A really important point to also make is the that forum support is also very good.

I am in the process of architecting a complete search solution (document,domain) for our company and Hibernate Search is the framework we will be using for implementation.

It seems to me you are over complicating the problem, you need to do free text search across your domain model right? Just use Hibernate Search and let the framework return your desired results. As I mentioned earlier it seems a bit wasteful doing the search using Postgres and then using HQL to return the results.

As Hibernate Search is based on Lucene you can get to the Lucene API which gives you a whole lot of features(see lucene doucmentation). This also enables you to use Luke (a java ui that looks at lucene indexes). I have found Luke a valuable piece of diagnostic tool when working with Lucene.

Hope this helps.

Cheers

Amin


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 5:53 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Quote:
To be honest I would prefer Hibernate Search but the reference is in my opinion blurry and leaves to many questions and I am kind of a perfectionist and need to know how and what stuff is. I got scared and choose postgres which honestly is VERY easy to use + that their reference is very explanatory.

I am intrigued. Maybe you can help us improve the documentation? What exactly is so confusing and which information did you miss? Have you tried the quickstart section to get an introduction into the basic features?

If the online documentation is not enough you should get a copy of "Hibernate Search in Action". It contains all you need to know about Hibernate and Lucene and it also looks under the hood.

Quote:
I think generally that hibernate reference is to splitted and in too many places. But it might just be me :)

Can you give some concrete examples?

Quote:
I was thinking of searching my text with postgres first. Getting the ids wich is a very easy query.
And then use HQL / Criteria to match against all other fields in where the ids are the same as the ones returned by fulltext search.. not good ?

This is of course a valid approach. However, you will have to go twice to the database - once for the fulltext query and once for retrieving the objects. With Hibernate Search you only have one database access. Admittedly, you also have a Lucene search, but this happens in the same JVM.

--Hardy


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.