Hi David,
Quote:
In my indexed data there is a field called Company. In my advanced search I want to do a type ahead where in when I type the company name it will display from the index. However since Lucene will return to me all matching results that has the company name, I need to ensure that the search returns only distinct company name.
Lucene is not a database where you could work with DISTINCT. Lucene returns all documents matching the search query. One way of going about it would be to use projection on the company name (which is probably a good idea anyways) and remove duplicates from the results yourself. Depending on the number of company names it might make sense to use a db query to solve the problem as well.
Quote:
Is this possible in hibernate search or we need to do faceting to achieve this?
I don't think faceting will help. Faceting is about narrowing/categorizing the results of an executed search.