Hi,

You could require all search terms (using QueryParser.SetDefaultOperator). This 
would also cause misspelt words to give you empty search results (assuming 
there's no matching misspelt indexed word in your data). 

Another approach would be a faceted search; you could tag your products with 
"C", "D", "B12" (etc.) and allow the user to apply filtering to the search 
result.

Example: http://www.ebay.com/sch/i.html?_nkw=Lucene+in+Action
The left column provides easy filtering of the search result. Note that there 
are filters for different fields (topics, language, condition, ...) and the 
ability to select several values for a field (topics: internet, networking, 
programming, ...)

You could implement this to allow the end-user to select a product type (pills, 
drinks) and contents (C, D, B12). This would make it possible to list all 
drinks containing vitamin C using a few clicks, while at the same time exposing 
other product types. Selecting only vitamin C would show you available product 
types, perhaps with a count; Pills (4), Drinks(9).

The actual search can be implemented using the IndexSearcher.Search overload 
which takes a filter.

// Simon

-----Original Message-----
From: Geoff Hingston [mailto:ge...@kupesoftware.com] 
Sent: Wednesday, May 23, 2012 1:31 AM
To: lucene-net-user@lucene.apache.org
Subject: Querying for Vitamin C

Hi All,

I have a client who sells Vitamins. How do we make sure that when the user 
enters the search phrase "Vitamin C Drinks" returns all documents with the 
phrase "Vitamin C" and drinks and not just Vitamin and Drinks.

Thanks,
Geoff



Reply via email to