FIX: in:title should work irrespective of the order. (#6968)
This commit is contained in:
parent
2c222e16fe
commit
4f3ee86bbd
|
@ -157,6 +157,7 @@ class Search
|
||||||
term.gsub!(/[\u201c\u201d]/, '"')
|
term.gsub!(/[\u201c\u201d]/, '"')
|
||||||
|
|
||||||
@clean_term = term
|
@clean_term = term
|
||||||
|
@in_title = false
|
||||||
|
|
||||||
term = process_advanced_search!(term)
|
term = process_advanced_search!(term)
|
||||||
|
|
||||||
|
@ -551,8 +552,6 @@ class Search
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@in_title = false
|
|
||||||
|
|
||||||
if word == 'order:latest' || word == 'l'
|
if word == 'order:latest' || word == 'l'
|
||||||
@order = :latest
|
@order = :latest
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -1053,6 +1053,19 @@ describe Search do
|
||||||
results = Search.execute('first in:title')
|
results = Search.execute('first in:title')
|
||||||
expect(results.posts.length).to eq(0)
|
expect(results.posts.length).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'works irrespective of the order' do
|
||||||
|
topic = Fabricate(:topic, title: "A topic about Discourse")
|
||||||
|
Fabricate(:post, topic: topic, raw: "This is another post")
|
||||||
|
topic2 = Fabricate(:topic, title: "This is another topic")
|
||||||
|
Fabricate(:post, topic: topic2, raw: "Discourse is awesome")
|
||||||
|
|
||||||
|
results = Search.execute('Discourse in:title status:open')
|
||||||
|
expect(results.posts.length).to eq(1)
|
||||||
|
|
||||||
|
results = Search.execute('in:title status:open Discourse')
|
||||||
|
expect(results.posts.length).to eq(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'ignore_diacritics' do
|
context 'ignore_diacritics' do
|
||||||
|
|
Loading…
Reference in New Issue