Search with terms filter in 1.4.2

Topics: Core, Customizing Orchard
May 22, 2013 at 10:41 PM
Hi,

Appologies if this has been covered but couldn't find the answer I was looking for. I'm attempting to filter search results by a specific content type and multiple taxonomy terms. I understand queries and projections could probably get me what I want but I'm stuck on ver 1.4.2 for various reasons. I'd basically just like to filter search results by multiple terms across multiple taxonomies.

The code fragment (SearchController.cs) below is my first attempt at retrieving a specific taxonomy and term;
            try
            {
                // Ok, I know how to find the taxonomy and term I'm interested in
                var taxonomy = _taxonomyService.GetTaxonomyByName("Finish");
                var term = _taxonomyService.GetTermByName(taxonomy.Id, "Cherry");
                
                // This would get me the specific content items for the first term,
                // but how would I introduce a second term
                var query = _taxonomyService.GetContentItemsQuery(term);

                // This is the original search that I'd like to replace using the new query
                // filtered by mutiple terms from separate taxonomies
                searchHits = _searchService.Query(q, pager.Page, pager.PageSize,
                                                  Services.WorkContext.CurrentSite.As<SearchSettingsPart>().Record.FilterCulture,
                                                  searchFields,
                                                  searchHit => searchHit);
            }
Any help would be much appreciated.

Many thanks.