This project is read-only.

facet search

Feb 13, 2012 at 7:35 PM


How can i performan a facet search?



Feb 14, 2012 at 12:04 PM

This isn't really specific to SimpleLucene. To create a faceted search I would recommend you make use of query objects - see

Based on this example, assume you have a web forms page with a free text box and additional filters like price. In your search button click event handler you could do something like:

	var indexSearcher = new DirectoryIndexSearcher(new DirectoryInfo(indexPath), true);
	using (var searchService = new SearchService(indexSearcher)) {
		var query = new ProductQuery().WithKeywords(txtKeywords.Text);
		// build up the query using additional filters:
		if !(string.IsNullOrEmpty(txtFromPrice.Text) && 
				string.IsNullOrEmpty(txtToPrice.Text)) {
			query = query.WithPriceBetween(decimal.Parse(txtFromPrice.Text),
		// you can chain more queries on here
		var result = searchService.SearchIndex(query.Query);
		// do something with results

Using query objects you can chain as many filters together as you like.

Hope that helps