I've constructed a very basic hibernate search from the hibernate documentation. I'm having a difficult time restricting the results and would like a little advise pertaining to what I'm doing wrong.
Scenario
Lets say I'm using one entity with a description title like so
@Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO)
private String name;
with the following data added to the index
1. Dell Laptop
2. Dell Desktop
3. HP Desktop
My search looks like so,
FullTextSession fullTextSession = Search.getFullTextSession(sessionManager.getSession());
QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Computer.class).get();
Query luceneQuery = queryBuilder.keyword().onFields("name").matching(keyword).createQuery();
org.hibernate.search.FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, Computer.class);
Now everything functions well when you do a keyword search using the following,
Dell returns Dell Laptop, Dell Desktop
Desktop returns Dell, HP
However when you do a search like so, it doesn't restrict the results properly
Dell Desktop returns Dell Laptop, Dell Desktop, HP Desktop.
How would I restrict the results to only return a single match?