-->
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.  [ 9 posts ] 
Author Message
 Post subject: Can/Will Hibernate Search Do This?
PostPosted: Sat Sep 27, 2008 12:40 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
I have something like the following:

A.List<B>B.C.name

I want to do a search based on the name value but the root of the search is the entity A

So the query ends up being like: +A.B.C.name:"some name"

My resulting list will be of List<A> but here is the question.

If there is a match found where List<B>.C.name = "some name" but also in that list there is an entry where Lisb<B>.C.name != "some name"

Can/Will Hibernate Search filter those out?

I have a requirement where the resulting set must be A for the presentation layer but the criteria is to have onetomany must occur values that will be displayed on the UI.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2008 1:57 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
If it can't, if there is something that it could provide to aid with this would be great.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2008 6:37 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
I've looked at the tool Luke and it provides an option when searching to filter out the low scores how do you do this with Hibernate Search in the case I stated above?


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

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
If there is a match found where List<B>.C.name = "some name" but also in that list there is an entry where Lisb<B>.C.name != "some name"

in this case when searching for "A"s you will find them using a simple query;
you can however change the way you do the query if it doesn't suit you.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 3:08 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
double post, message below


Last edited by mrsmith on Sun Sep 28, 2008 3:13 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 3:09 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
s.grinovero wrote:
Quote:
If there is a match found where List<B>.C.name = "some name" but also in that list there is an entry where Lisb<B>.C.name != "some name"

in this case when searching for "A"s you will find them using a simple query;
you can however change the way you do the query if it doesn't suit you.


Unfortunately I need to return A, to my caller so even if I searched on B then returned the A they would show up in the interface since they are accessing that field by iterating across all in the list.

With Luke filtering these results were easy just by clicking the button that filters out the low scores. I was hoping HS would have a mechanism to behave the same way. Perhaps construct entities that are detached with those non-matching entities removed?

This is a pretty big deviation from the way Lucene works from my very basic understanding. Not being able to do something like this is a real problem.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 4:57 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
Unfortunately I need to return A, to my caller so even if I searched on B then returned the A

I meant searching on A; using a simple query on A you will find all As having at least one B.C.name=param.

What I didn't understand is if this behavior is what you want or is what you want to avoid.

If the results you need are "all As having at least one B.C.name=param and not any B.C.name!=param" then I think you should totally change your approach. It would equivalent to google on the web for something like "give me all pages which contain the word "hibernate" and contain no other words"... it doesn't sound like fit for a fulltext search IMHO.

So if you need an exact answer of this type, I think you should use plain HQL, but I still didn't understand what you need.

Quote:
With Luke filtering these results were easy just by clicking the button that filters out the low scores. I was hoping HS would have a mechanism to behave the same way. Perhaps construct entities that are detached with those non-matching entities removed?

This looks interesting, but how subjective is "low score"? You should check if the minimal score level you need could be defined as a constant... anything below 1?

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 7:11 pm 
Newbie

Joined: Sat Sep 27, 2008 12:29 pm
Posts: 6
I use a PhraseQuery for exact search.

I basically would like to have the A returned will all non-matching Bs removed from its list.

This is not the actual entity but a constructed partial copy of the entity.

The actual entity A has its List<B> will all the values.

The copy or reconstituted A has its List<B> with all the matched values.

If this is possible it's great if not ... . From what I have heard this sort of thing is very possible with Lucene or other Lucene based frameworks.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 4:10 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
From what I have heard this sort of thing is very possible with Lucene or other Lucene based frameworks.

well Lucene has nothing to do with entities, so I don't really understand this.

you are not making a Query, you want new objects so you'll have to fetch all A's first and then construct what you are needing.

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