0
我需要你的帮助。我想在全文太阳黑子搜索中获得匹配的字符串。 那是我的代码如何在目前太阳黑子轨 - 在全文搜索中获得匹配的子字符串
search2 = WebsiteEntry.search do
fulltext params[:q]
end
search2.each_hit_with_result do |hit, res|
@match = <Here I need your Help, i need the substring on which sunspot made a hit>
@results.push SearchResult.new(res, hit.score, @match)
end
end
看起来像现在,如果i'm搜索单词“测试”黑子看上去一切,其中“测试”是一个子不区分大小写。 例如:太阳黑子返回匹配的单词“FirstTest”或“TEST2”或“testit”。
是否有可能获得匹配的字符串?我需要太阳黑子击中的字符串
从“FirstTest”需要点击“测试”。因为我想显示太阳黑子创建比赛的地方。所以,从“FirstTest”我需要子字符串“测试”。从“TEST2”我需要“测试”等。
谢谢。