From a1ebd67237823bb1b17f1623a158495219535b02 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sat, 3 Jun 2017 01:54:35 +0530 Subject: [PATCH] Revert "FEATURE: new setting to prioritize open topics in search" --- config/locales/server.en.yml | 1 - config/site_settings.yml | 1 - lib/search.rb | 2 -- spec/components/search_spec.rb | 20 -------------------- 4 files changed, 24 deletions(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 0c771dccfe1..a1998eeb084 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -938,7 +938,6 @@ en: search_tokenize_chinese_japanese_korean: "Force search to tokenize Chinese/Japanese/Korean even on non CJK sites" search_prefer_recent_posts: "If searching your large forum is slow, this option tries an index of more recent posts first" search_recent_posts_size: "How many recent posts to keep in the index" - prioritize_open_topics_in_search: "Closed topics in search results will show up after open topics" allow_uncategorized_topics: "Allow topics to be created without a category. WARNING: If there are any uncategorized topics, you must recategorize them before turning this off." allow_duplicate_topic_titles: "Allow topics with identical, duplicate titles." unique_posts_mins: "How many minutes before a user can make a post with the same content again" diff --git a/config/site_settings.yml b/config/site_settings.yml index 49867b8b6fa..62a6b009bd8 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -1132,7 +1132,6 @@ search: search_tokenize_chinese_japanese_korean: false search_prefer_recent_posts: false search_recent_posts_size: 100000 - prioritize_open_topics_in_search: false uncategorized: version_checks: diff --git a/lib/search.rb b/lib/search.rb index 44153f47550..543149b18e2 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -694,8 +694,6 @@ class Search posts = posts.order("posts.like_count DESC") end else - posts = posts.order("topics.closed") if SiteSetting.prioritize_open_topics_in_search - posts = posts.order("TS_RANK_CD(TO_TSVECTOR(#{query_locale}, topics.title), #{ts_query}) DESC") data_ranking = "TS_RANK_CD(post_search_data.search_data, #{ts_query})" diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index b3f89733037..d215c8835c3 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -662,26 +662,6 @@ describe Search do expect(Search.execute('Topic order:latest_topic').posts.map(&:id)).to eq([latest_irelevant_topic_post.id, old_relevant_topic_post.id]) end - context 'can prioritize open topics in search' do - before do - open_topic = Fabricate(:topic, title: 'Open Topic, testing prioritize open topics setting') - closed_topic = Fabricate(:topic, title: 'Closed Topic, testing prioritize open topics setting', closed: true) - - @open_irrelevant_topic_post = Fabricate(:post, topic: open_topic, raw: 'Not Relevant') - @closed_relevant_topic_post = Fabricate(:post, topic: closed_topic, raw: 'Relevant Topic') - end - - it "when prioritize_open_topics_in_search is disabled" do - SiteSetting.prioritize_open_topics_in_search = false - expect(Search.execute('Topic').posts.map(&:id)).to eq([@closed_relevant_topic_post.id, @open_irrelevant_topic_post.id]) - end - - it "when prioritize_open_topics_in_search is enabled" do - SiteSetting.prioritize_open_topics_in_search = true - expect(Search.execute('Topic').posts.map(&:id)).to eq([@open_irrelevant_topic_post.id, @closed_relevant_topic_post.id]) - end - end - it 'can tokenize dots' do post = Fabricate(:post, raw: 'Will.2000 Will.Bob.Bill...') expect(Search.execute('bill').posts.map(&:id)).to eq([post.id])