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 :(