Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive searching #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Case insensitive searching
- Using `ILIKE` instead `LIKE` matches case insensitive.
  https://www.postgresql.org/docs/8.3/functions-matching.html
- #122
  • Loading branch information
kitsuyui committed May 6, 2019
commit 9184389f3da2a0e041df09a6bd69d86a200e611e
4 changes: 2 additions & 2 deletions app/models/search_result.rb
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ def initialize(*args)

def search!
return unless keyword.present?
self.results += TableMemo.where("table_memos.name LIKE ?", "%#{keyword}%").eager_load(schema_memo: :database_memo).to_a
self.results += ColumnMemo.where("column_memos.name LIKE ?", "%#{keyword}%").eager_load(table_memo: {schema_memo: :database_memo}).to_a
self.results += TableMemo.where("table_memos.name ILIKE ?", "%#{keyword}%").eager_load(schema_memo: :database_memo).to_a
self.results += ColumnMemo.where("column_memos.name ILIKE ?", "%#{keyword}%").eager_load(table_memo: {schema_memo: :database_memo}).to_a
end
end