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