我已经浏览了github中的文档:http://github.com/outoftime/sunspot来找到突出显示的解决方案,但它似乎对我不起作用.
我的工作模型有这样的块(有意省略了一些字段):
searchable do
text :name
string :name, :stored => true
time :updated_at
time :created_at
time :expires_on
我有这个,它返回结果:
search = Sunspot.search(Job) do keywords 'Senior', :fields => "name", :highlight => true end => 0, :fl=>"* score", :"hl.simple.pre"=>"@@@hl@@@", :qf=>"name_text", :rows=>30, :"hl.simple.post"=>"@@@endhl@@@", :hl=>"on", :q=>"senior", :fq=>["type:Job"], :defType=>"dismax"}>
并获得如此命中:
>> search.hits => [#, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #]
这是查询的结果,显示名称:
>> search.results.collect{|x| x.name}
= … 我们有一个使用SQL Server 2008作为数据库的Web应用程序.我们的用户可以对数据库中的特定列进行全文搜索.SQL Server的全文功能似乎不支持命中突出显示.我们是否需要自己构建这个或者是否有一些关于如何做到这一点的图书馆或知识?
BTW应用程序是用C#编写的,因此.Net解决方案是理想的,但不是必需的,因为我们可以翻译.
我是Azure Search Service的新手,我想使用Azure Search Service的热门突出显示功能.我使用.NET SDK NuGet包进行azure搜索.
我使用SearchParameter对象来提及命中突出显示字段以及我需要的前后标记.
searchParameters.HighlightFields = new[] { "Description"};
searchParameters.HighlightPreTag = "<b>";
searchParameters.HighlightPostTag = "</b>";
_searchIndexClient.Documents.Search(searchText, searchParameters);
Run Code Online (Sandbox Code Playgroud)
我期待这样的事情:
SearchText:最好的
结果(描述):最好的产品
问题是我没有看到使用/不使用点击突出显示的结果有任何差异.(描述字段是可搜索的)
我错过了什么?
Sql Server 2008本身不支持其FTS功能中的命中突出显示,目前您必须使用各种技术实现自己.微软在未来的SQL Server版本中包含了一些模糊的声音.
有谁知道SQL Server 2012 FTS是否会对点击突出显示提供原生支持?
full-text-search sql-server-2008 hit-highlighting sql-server-2012