Hi guys,
I'm trying to write a search engine query for a website. So, I'm wondering if Hibernate Search supports 'AND' and 'OR' fullText queries? Please, I would apprecite any examples you can provide.
Here's my query:
Code:
FullTextSession fullTextSession = Search.createFullTextSession( session );
QueryParser parser = new QueryParser("businessId", new StandardAnalyzer());
org.apache.lucene.search.Query query = parser.parse("businessName:" + keywords + "~");
query = parser.parse("businessAddresses.address.cityName:" + criteria_.cityName + "~");
query = parser.parse("businessAddresses.address.state:" + criteria_.stateName);
query = parser.parse("businessServiceCategories.serviceCategory.serviceCategoryName:" + keywords + "~");
query = parser.parse("businessServices.service.serviceName:" + keywords + "~");
query = parser.parse("businessSubCategories.serviceSubCategory.serviceSubCategoryName:" + keywords + "~");
Criteria criteria = fullTextSession.createCriteria( BusinessCbo.class )
.setFetchMode( "businessAddresses", FetchMode.JOIN )
.setFetchMode( "businessServiceCategories", FetchMode.JOIN )
.setFetchMode( "businessServices", FetchMode.JOIN )
.setFetchMode( "businessSubCategories", FetchMode.JOIN );
searchQry = fullTextSession.createFullTextQuery( query ).setCriteriaQuery( criteria );
result = paginator.getPaginatdResult(session,countQry,searchQry,paginationControl_);
I need to find out if a "keyword" matches a service a business offers OR a category the business fulls in OR a sub category the business fulls in for a given city AND state.
It looks my query above it just doing AND on all the possible search criterias, which I don't want.
Please...HeLP.