diff --git a/app/services/search_indexer.rb b/app/services/search_indexer.rb index 96d750a281a..40104c5b13c 100644 --- a/app/services/search_indexer.rb +++ b/app/services/search_indexer.rb @@ -1,12 +1,15 @@ # frozen_string_literal: true class SearchIndexer - POST_INDEX_VERSION = 4 - MIN_POST_REINDEX_VERSION = 3 - TOPIC_INDEX_VERSION = 3 + MIN_POST_BLURB_INDEX_VERSION = 4 + + POST_INDEX_VERSION = 5 + TOPIC_INDEX_VERSION = 4 CATEGORY_INDEX_VERSION = 3 USER_INDEX_VERSION = 3 TAG_INDEX_VERSION = 3 + + # version to apply when issuing a background reindex REINDEX_VERSION = 0 TS_VECTOR_PARSE_REGEX = /('([^']*|'')*'\:)(([0-9]+[A-D]?,?)+)/ diff --git a/config/site_settings.yml b/config/site_settings.yml index 1dd04eeca65..679b6771bfa 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -2191,10 +2191,10 @@ search: default: false hidden: true prioritize_exact_search_title_match: - default: false + default: true hidden: true max_duplicate_search_index_terms: - default: -1 + default: 6 hidden: true use_pg_headlines_for_excerpt: default: false diff --git a/lib/search/grouped_search_results.rb b/lib/search/grouped_search_results.rb index f3470963eb5..ccb9c84b014 100644 --- a/lib/search/grouped_search_results.rb +++ b/lib/search/grouped_search_results.rb @@ -71,7 +71,7 @@ class Search def blurb(post) opts = { term: @blurb_term, blurb_length: @blurb_length } - if post.post_search_data.version > SearchIndexer::MIN_POST_REINDEX_VERSION && + if post.post_search_data.version >= SearchIndexer::MIN_POST_BLURB_INDEX_VERSION && !Search.segment_chinese? && !Search.segment_japanese? if SiteSetting.use_pg_headlines_for_excerpt scrubbed_headline = post.headline.gsub(SCRUB_HEADLINE_REGEXP, '\1') diff --git a/spec/jobs/reindex_search_spec.rb b/spec/jobs/reindex_search_spec.rb index ae63f64d055..a9885598d2c 100644 --- a/spec/jobs/reindex_search_spec.rb +++ b/spec/jobs/reindex_search_spec.rb @@ -70,7 +70,7 @@ RSpec.describe Jobs::ReindexSearch do end it "should not reindex posts with a developmental version" do - post = Fabricate(:post, version: SearchIndexer::MIN_POST_REINDEX_VERSION + 1) + Fabricate(:post, version: SearchIndexer::POST_INDEX_VERSION + 1) subject.rebuild_posts(indexer: FakeIndexer) diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rb index feca2de42eb..5608da93402 100644 --- a/spec/lib/search_spec.rb +++ b/spec/lib/search_spec.rb @@ -122,6 +122,8 @@ RSpec.describe Search do before do SearchIndexer.enable + SiteSetting.max_duplicate_search_index_terms = -1 + SiteSetting.prioritize_exact_search_title_match = false [post1, post2].each { |post| SearchIndexer.index(post, force: true) } end