Merge remote-tracking branch 'parent/main' into kb_migration

This commit is contained in:
KMY 2023-09-10 16:17:34 +09:00
commit 979292d950
56 changed files with 774 additions and 277 deletions

View file

@ -57,4 +57,24 @@ describe SearchQueryTransformer do
expect(subject.send(:filter_clauses)).to be_empty
end
end
context 'with \'"hello world"\'' do
let(:query) { '"hello world"' }
it 'transforms clauses' do
expect(subject.send(:must_clauses).map(&:phrase)).to contain_exactly('hello world')
expect(subject.send(:must_not_clauses)).to be_empty
expect(subject.send(:filter_clauses)).to be_empty
end
end
context 'with \'before:"2022-01-01 23:00"\'' do
let(:query) { 'before:"2022-01-01 23:00"' }
it 'transforms clauses' do
expect(subject.send(:must_clauses)).to be_empty
expect(subject.send(:must_not_clauses)).to be_empty
expect(subject.send(:filter_clauses).map(&:term)).to contain_exactly(lt: '2022-01-01 23:00', time_zone: 'UTC')
end
end
end