-->
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.  [ 2 posts ] 
Author Message
 Post subject: Having problems with relevance ordering and filtering
PostPosted: Thu Nov 20, 2014 1:47 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Hi,
So, I've been working with Hibernate Search off and on for a while now and I just can't quite get it right. I thought my requirements were pretty simple, but maybe not.

Let's say I have the following class...

Code:
class Person
{
@Field
@Boost(3f)
public String name;
@Field
@Boost(2f)
public String address;
@Field
@Boost(1f)
public String phone
@Field
public String status
@Field
public boolean employee
}


I want a single search box where the user can search on name, slightly misspelled names, partial name, partial address, phone number on certain types of people.

I'm getting stuck on a few things.... relevance sorting and filtering.
If I type in the person's first name and last initial, I get strange ordering.

For example, I might search on "Judy B". The order of the results I get might be something like..

R B Pump and Seal
Judy Jones
Judy Kartoff
Judy Gossemer
Judy Bibby

Why wouldn't Judy Bibby be first?

I suppose it is problem in how i'm building my query. I really don't know what I'm doing and my query is a huge mess. So rather than posting it here and asking what's wrong, I think it might be easier to kindly ask someone if they could give me at least a rough outline of what my query SHOULD look like.
If I were writing it in SQL it would be something along these lines..

Code:
select * from person where name || ' ' || address || ' ' || phone like '%judy b%' and status = 'hired' and employed = true order by relevance desc


Your help would be much appreciated. I've spent so much time on this :(


Top
 Profile  
 
 Post subject: Re: Having problems with relevance ordering and filtering
PostPosted: Fri Nov 21, 2014 4:21 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Never mind. I've given up on this and went back to you using native SQL tools.


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