keep mappings over field array values
This commit is contained in:
@@ -98,6 +98,12 @@ class SqlGeneratorTester
|
||||
expect(@query.where_clause).to eq ['tags.name ILIKE ?', '%h1-r%']
|
||||
end
|
||||
|
||||
it 'tests search with field mappings when fields array has same mapping' do
|
||||
@query = TextToSqlQuery.new('tags:hs1-r', [:'players.title', :'players.tags', :'players.device_id'], :'players.device_id', { tags: "tags.name" })
|
||||
|
||||
expect(@query.where_clause).to eq ['tags.name ILIKE ?', '%hs1-r%']
|
||||
end
|
||||
|
||||
it 'tests complex query' do
|
||||
text = '(device_id:"with space" tags:mta no-quotes-id-123)'\
|
||||
'or "id with quotes-5" and ( ("id with q 10" or "id with q 20")'\
|
||||
|
||||
@@ -10,6 +10,9 @@ class TextToSqlQuery
|
||||
mappings[field_name.to_sym] = field
|
||||
mappings
|
||||
end)
|
||||
fields_mappings.each do |field, value|
|
||||
@fields_mappings[field] = value if @fields_mappings[field]
|
||||
end
|
||||
end
|
||||
|
||||
def where_clause
|
||||
|
||||
Reference in New Issue
Block a user