Searchkick number_of_fragments无效

时间:2015-12-10 17:13:13

标签: ruby-on-rails elasticsearch searchkick

我在Rails应用程序中使用Searchkick和Elasticsearch创建了高亮功能。

像这样:

      def index
        @book_searches = Book.search(params[:query], operator: "or", fields: [:description], highlight: {tag: "<strong>", fields: {description: {number_of_fragments: 3, fragment_size: 100}}})
        @chapter_searches = Chapter.search(params[:query], operator: "or", fields: [:body], highlight: {tag: "<strong>", fields: {body: {number_of_fragments: 3, fragment_size: 100}}})
      end

number_of_fragments 部分外,一切正常。有人有解决方案吗?

我正在寻找类似于论文的结果:

Search for "minimum wage"

Returns "a **minimum wage** rate maximum number of hours overtime pay child labor (see ... to pay a **minimum wage** and overtime to many employees, it also contains ... Pennsylvania’s **Minimum Wage** Act currently sets the minimum wage at the same rate ..."

它返回大约三个在文本正文中彼此分开的句子和(...)。

0 个答案:

没有答案