commentaries: perform full-text search instead of substring search.

Switch `/artist_commentaries?search[text_matches]` to do a full-text
search instead of a substring search. This is more consistent with text
search in other places.
This commit is contained in:
evazion
2022-09-22 01:17:26 -05:00
parent 29a4ca0818
commit b56b6c554b
2 changed files with 2 additions and 19 deletions

View File

@@ -29,12 +29,7 @@ class ArtistCommentary < ApplicationRecord
module SearchMethods
def text_matches(query)
query = "*#{query}*" unless query =~ /\*/
where_ilike(:original_title, query)
.or(where_ilike(:original_description, query))
.or(where_ilike(:translated_title, query))
.or(where_ilike(:translated_description, query))
where_text_matches(%i[original_title original_description translated_title translated_description], query)
end
def search(params)