FIX: Cooked snippet of raw in Topic.similar_to.

If we don't cook the raw, we end up trying to match uncooked raw against
`TopicSearchData#search_data` which consists of cooked raw.
This commit is contained in:
Guo Xiang Tan
2020-07-28 15:20:18 +08:00
parent 4b21b5aac1
commit 4f8262e0d5
2 changed files with 21 additions and 1 deletions

View File

@@ -587,8 +587,12 @@ class Topic < ActiveRecord::Base
)
if raw.present?
cooked = SearchIndexer::HtmlScrubber.scrub(
PrettyText.cook(raw[0...MAX_SIMILAR_BODY_LENGTH].strip)
)
raw_tsquery = Search.set_tsquery_weight_filter(
Search.prepare_data(raw[0...MAX_SIMILAR_BODY_LENGTH].strip),
Search.prepare_data(cooked),
'B'
)