Append * on simple query like "somephrase23" or "attribute: somephrase23"

This commit is contained in:
Martin Edenhofer 2017-08-24 00:53:36 +02:00
parent 81c6aa0af0
commit e81d871b01

View file

@ -198,9 +198,12 @@ return search result
data['query']['bool']['must'] = []
end
# add * on simple query search
if query && query =~ /^[[:alpha:]]+$/
query += '*'
# add * on simple query like "somephrase23" or "attribute: somephrase23"
if query.present?
query.strip!
if query =~ /^([[:alpha:],0-9]+|[[:alpha:]]+\:\s+[[:alpha:],0-9]+)$/
query += '*'
end
end
# real search condition