我有一些代碼,與下面的目錄檢索一個RavenDB數據庫:RavenDB查詢建議多字
public class Products_Search :
AbstractIndexCreationTask<Product, Products_Search.Result>
{
public class Result
{
public string Query { get; set; }
}
public Products_Search()
{
Map = products =>
from product in products
select new
{
Query = new
{
Categories = product.Categories.Boost(5),
Brands = product.Brands.Boost(8),
product.Description,
Name = product.Name.Boost(10),
product.SKU
},
product.Price
};
Index(x => x.Query, FieldIndexing.Analyzed);
}
}
如果我詢問對這個像這樣(包括草莓蛋白拼寫錯誤):
var query = RavenSession.Query<Products_Search.Result, Products_Search>()
.Where(x => x.Query == "strawbery protien");
var suggestions = query.Suggest().Suggestions.Take(5)
我想建議是「草莓蛋白質」不是「草莓」和「蛋白質」的另一個。這可能與RavenDB?