FIX: Short terms will be searched for if at least one is long enough

This commit is contained in:
Robin Ward 2016-08-11 11:52:53 -04:00
parent 58834663a8
commit 7e165d031b
2 changed files with 3 additions and 4 deletions

View File

@ -196,7 +196,6 @@ class Search
@valid = false
return
end
@term = terms.join(' ') if @term.include?(' ')
end
# If the term is a number or url to a topic, just include that topic

View File

@ -67,7 +67,7 @@ describe Search do
expect(search.term).to eq('')
end
it 'does not search for multiple small terms' do
it 'needs at least one term that hits the length' do
search = Search.new('a b c d', min_search_term_length: 5)
search.execute
expect(search.valid?).to eq(false)
@ -81,11 +81,11 @@ describe Search do
expect(search.term).to eq('"a b c d"')
end
it 'discards short terms' do
it 'searches for short terms if one hits the length' do
search = Search.new('a b c okaylength', min_search_term_length: 5)
search.execute
expect(search.valid?).to eq(true)
expect(search.term).to eq('okaylength')
expect(search.term).to eq('a b c okaylength')
end
it 'escapes non alphanumeric characters' do