public List<UniversalSearchItemQuickSearch> QuickSearch(QuickSearchParams searchParams)
        {
            IndexSearcher searcher = _universalSearchIndexManager.GetSearcher();
            var query = new BooleanQuery {GetFilterByTerm(searchParams.Term)};

            if (!string.IsNullOrWhiteSpace(searchParams.Type))
            {
                query.Add(FilterByEntityType(searchParams.Type));
            }
            TopDocs topDocs = searcher.Search(query, 10);

            List<UniversalSearchItem> universalSearchItems =
                topDocs.ScoreDocs.Select(doc => _searchConverter.Convert(searcher.Doc(doc.Doc))).ToList();

            return universalSearchItems.Select(item => new UniversalSearchItemQuickSearch(item)).ToList();
        }
示例#2
0
 public JsonResult QuickSearch(QuickSearchParams searchParams)
 {
     return Json(_searchIndexSearcher.QuickSearch(searchParams), JsonRequestBehavior.AllowGet);
 }