Hi, I'm using Hibernate Search 4.5.
First.. I'm new to this and setup has been a snap. I'm just having some difficulty moving beyond a simple search. I've searched and found people asking similar questions, but I can't quite get there.
Let's say I'm searching Car entities and each Car has a "type" association (@ManyToOne). The possible types are Van, Sedan, Truck, SUV, etc. Now let's say I want to do a text search on ONLY trucks and sedans. I want to do this by using the truck and sedan entity IDs.
I have no problem filtering on a single type ID as follows....
Code:
org.apache.lucene.search.Query query1 = qb
.keyword()
.fuzzy()
.onFields("description")
.matching(searchString)
.createQuery()
;
org.apache.lucene.search.Query query2= qb
.keyword()
.onField("type.id")
.matching("100")
.createQuery();
org.apache.lucene.search.Query finalQuery = qb
.bool()
.should( query1 )
.must( query2 )
.createQuery();
But how can I filter on multiple type IDs? This part cannot be fuzzy. This result MUST include only the requested types. Pseudo code illustrating what I would like to do below...
Code:
org.apache.lucene.search.Query query2= qb
.keyword()
.onField("type.id")
.matching("100").or("200").or("300")
.createQuery();
Any ideas? Thanks!