Append * on simple query like "somephrase23" or "attribute: somephrase23"
This commit is contained in:
parent
81c6aa0af0
commit
e81d871b01
1 changed files with 6 additions and 3 deletions
|
@ -198,10 +198,13 @@ 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.strip!
|
||||||
|
if query =~ /^([[:alpha:],0-9]+|[[:alpha:]]+\:\s+[[:alpha:],0-9]+)$/
|
||||||
query += '*'
|
query += '*'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# real search condition
|
# real search condition
|
||||||
condition = {
|
condition = {
|
||||||
|
|
Loading…
Reference in a new issue