Revert "FEATURE: hidden site setting to disable search prefix matching (#20058)" (#20073)

This reverts commit 64f7b97d083a99a99f6bf91c32f4a2ba6b781d86.

Too many side effects for this setting, we have decided to remove it
This commit is contained in:
Sam 2023-01-31 10:39:23 +11:00 committed by GitHub
parent 4d12bdfdcb
commit 5d669d8aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 26 deletions

View File

@ -2192,9 +2192,6 @@ backups:
client: true client: true
search: search:
enable_search_prefix_matching:
default: true
hidden: true
use_pg_headlines_for_excerpt: use_pg_headlines_for_excerpt:
default: false default: false
hidden: true hidden: true

View File

@ -1237,8 +1237,7 @@ class Search
end end
def self.set_tsquery_weight_filter(term, weight_filter) def self.set_tsquery_weight_filter(term, weight_filter)
optional_star = SiteSetting.enable_search_prefix_matching ? "*" : "" "'#{self.escape_string(term)}':*#{weight_filter}"
"'#{self.escape_string(term)}':#{optional_star}#{weight_filter}"
end end
def self.escape_string(term) def self.escape_string(term)

View File

@ -2580,25 +2580,4 @@ RSpec.describe Search do
expect(result.categories.length).to eq(0) expect(result.categories.length).to eq(0)
end end
end end
context "when enable_search_prefix_matching is disabled" do
before do
SearchIndexer.enable
SiteSetting.enable_search_prefix_matching = false
end
fab!(:post) do
Fabricate(:post, topic: topic, raw: "this body of the post contains abracadabra")
end
it "omits prefix search results" do
SearchIndexer.index(post, force: true)
result = Search.execute("abra")
expect(result.posts.length).to eq(0)
result = Search.execute("abracadabra")
expect(result.posts.length).to eq(1)
end
end
end end