在Lucene.net 4.8.0中等效于SimpleFacetedSearch

时间:2019-01-07 11:03:27

标签: lucene.net

我在Lucene 3.0.3中使用SimpleFacetedSearch。对于以下代码,Lucene.net 4.8.0中的等效内容是什么? SimpleFacetedSearch不再存在。

这是我从V3.0.3起的代码

var facet = new SimpleFacetedSearch(reader, searchFacetField.SearchIndexField);
var result = facet.Search(query);
var hits = result.HitsPerFacet
  .Where(h => h.HitCount > 0)
  .OrderByDescending(h => h.HitCount)
  .Take(availableSearchFacetField.MaxResults);

searchFacetField.TotalHitCount = result.TotalHitCount;
searchFacetField.SearchFacetObject.SearchFacetList = new List<DtoSearchFacet>();

foreach (var hit in hits)
{
  DtoSearchFacet searchFacet = new DtoSearchFacet();
  searchFacet.HitResultCount = hit.HitCount;
  searchFacet.HitResultId = hit.Name.ToString();
  ...
}

0 个答案:

没有答案