我能夠保留一個斷點並查看結果。亮點
我的視圖模型
[SolrField("health_content_t")]
public string HealthContent { get; set; }
[SolrField("description_t")]
public string Description { get; set; }
[SolrField("title_t")]
public string Title { get; set; }
[SolrField("_fullpath")]
public string PageUrl { get; set; }
我的控制器
var queryOption = new QueryOptions
{
FilterQueries = BuildFilterQueries(parameters),
Rows = parameters.PageSize,
Start = start,
SpellCheck = new SpellCheckingParameters
{
Collate = true
},
Highlight = new HighlightingParameters
{
Fragsize = 250,
Fields = new[] { "*" },
BeforeTerm = "<b>",
AfterTerm = "</b>",
Snippets = 1
}
};
var results = _searchResults.Query(BuildQuery(parameters), queryOption);
view = new SearchView
{
EntireSiteResults = results,
Search = parameters,
TotalCount = results.NumFound,
DidYouMean = GetSpellCheckingResult(results)
};
我查看
@foreach (var item in Model.EntireSiteResults)
{
<li>
<h2><a href="@item.PageUrl">@item.Title</a></h2>
<span class="sr-url"><a href="@item.PageUrl">@item.PageUrl</a></span>
<p>@item.Description</p>
</li>
}
我不知道我經歷的結果如何迭代。我將不得不顯示
標題,PAGEURL,用粗體搜索項,也表明以粗體顯示的搜索字詞healthContent
貌似我必須通過results.Highlights每個字段的迭代的片段?
任何指導,請