我有一些代码正在搜索具有以下索引的 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 有可能吗?