106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'app/models/lcms/engine/search/repository.rb', line 106
def fts_query(term, options)
return term if term.respond_to?(:to_hash)
limit = options.fetch(:per_page, 20)
page = options.fetch(:page, 1)
term = replace_synonyms term.downcase
query = {
min_score: 6,
query: {
bool: {
should: [
{ match: { 'title.full' => { query: term, boost: 3, type: 'phrase' } } },
{ match: { 'title.partial' => { query: term, boost: 0.5 } } },
{ match: { 'teaser.full' => { query: term, boost: 4, type: 'phrase' } } },
{ match: { document_metadata: { query: term, boost: 1 } } }
],
filter: []
}
},
size: limit,
from: (page - 1) * limit
}
apply_filters(query, options)
end
|