我沒有通過在Sitecore中使用術語查詢來獲得任何結果。我不確定如果我做錯了什麼。 以下是我的配置設置。Sitecore術語查詢和全文搜索
<demo type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
<Database>web</Database>
<Root>/sitecore/content/rootPath</Root>
<IndexAllFields>true</IndexAllFields>
<include hint="list:IncludeTemplate">
<uniqueTemplateToken1>
{2BCE925C-6ED5-4F76-99D6-BF928A62819B}
</uniqueTemplateToken1>
</include>
<include hint="list:IncludeField">
<fieldId>{7D55A5C3-CAF5-4570-AA7B-1240836BEE8D}</fieldId>
</include>
<fieldTypes hint="raw:AddFieldTypes">
<fieldType name="Multi-Line Text" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
</fieldTypes>
</demo>
這是我的代碼,其中「描述」是我申請的名字,我已經在配置中定義相同的申請名稱。每次我得到「0」結果。
using (IndexSearchContext sc = SearchManager.GetIndex("demo").CreateSearchContext())
{
TermQuery createdByAdminQuery = new TermQuery(new Term("Description", "Lorem"));
BooleanQuery query = new BooleanQuery();
query.Add(createdByAdminQuery, BooleanClause.Occur.MUST);
query.SetMinimumNumberShouldMatch(1);
TopDocs topDocs = sc.Searcher.Search(query, int.MaxValue);
SearchHits searchHits = new SearchHits(topDocs,sc.Searcher.GetIndexReader());
return searchHits.FetchResults(0, int.MaxValue).Select(r => r.GetObject<Item>()).ToList();
}
請幫助我,如果我做錯了什麼。