Is it possible to mix a Lucene FullTextQuery and HQL?
I need a full text search for product names.
Moreover products are selected by prices, shops etc.
Maybe a kind of FullTextCriteria would be helpful!?
Scenario:
Code:
select * from products where name like '%canon%';
Because LIKE is very slow I use Lucene for full text search.
Next, I select products with a given name and price range.
Code:
select * from products where name like '%canon%' and price between 100 and 200;
Maybe it's not very elegant, but it's possible to manage price ranges with Lucene.
Last, I search products belonging to specific shops:
Code:
select * from products p left join shop s on p.shop_id=s.id
where s.postcode like '2%' and p.name like '%canon%' and p.price between 100 and 200;
This is not possible with a Lucene FullTextQuery. Therefore I want to combine Lucene FullTextQuery with HQL or Criterias.