Update multisearch for exclusions
This commit is contained in:
parent
020447ad4d
commit
ad6672620a
1 changed files with 11 additions and 5 deletions
|
|
@ -30,20 +30,26 @@ module Api
|
|||
end
|
||||
|
||||
def search_all_en
|
||||
PgSearch.multisearch_options = { using: TRIGRAM }
|
||||
results = PgSearch.multisearch(search_params[:query]).limit(10)
|
||||
query = search_params[:query]
|
||||
exclude = search_params[:exclude]
|
||||
|
||||
if (results.length < 5) && (search_params[:query].length >= 2)
|
||||
PgSearch.multisearch_options = { using: TRIGRAM }
|
||||
results = PgSearch.multisearch(query).where.not(granblue_id: exclude).limit(10)
|
||||
|
||||
if (results.length < 5) && (query.length >= 2)
|
||||
PgSearch.multisearch_options = { using: TSEARCH_WITH_PREFIX }
|
||||
results = PgSearch.multisearch(search_params[:query]).limit(10)
|
||||
results = PgSearch.multisearch(query).where.not(granblue_id: exclude).limit(10)
|
||||
end
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
def search_all_ja
|
||||
query = search_params[:query]
|
||||
exclude = search_params[:exclude]
|
||||
|
||||
PgSearch.multisearch_options = { using: TSEARCH_WITH_PREFIX }
|
||||
PgSearch.multisearch(search_params[:query]).limit(10)
|
||||
PgSearch.multisearch(query).where.not(granblue_id: exclude).limit(10)
|
||||
end
|
||||
|
||||
def characters
|
||||
|
|
|
|||
Loading…
Reference in a new issue