Esempio n. 1
0
        public List <UniversalSearchItemQuickSearch> QuickSearch(QuickSearchParams searchParams)
        {
            IndexSearcher searcher = _universalSearchIndexManager.GetSearcher();
            BooleanQuery  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());
        }