-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support weight #6
Comments
カラム毎に重みを変えるには、まず、マルチカラムインデックスをやめる。マルチカラムインデクスではすべてのカラムを同じように扱ってしまうから。 マルチカラムインデックスをやめるには次のようにするとよさそう。 まず、新しくマイグレーションファイルを作る。 次に↑で↓みたいにする。 drop_index(:fts_projects, [:name, :identifier, :description])
add_index(:fts_projects, :name, type: "fulltext")
add_index(:fts_projects, :identifier, type: "fulltext")
add_index(:fts_projects, :description, type: "fulltext")
# ...
WHERE MATCH(name, identifier, description) みたいなのを WHERE MATCH(name) ... OR
MATCH(identifier) ... OR
MATCH(description) みたいにする。 SELECT ..., MATCH(name) ... as score みたいなのを SELECT ..., MATCH(name) ... * 100 +
MATCH(identifier) ... * 100 +
MATCH(description) ...
as score みたいにする。 |
813f7a8 で大体できた。 |
カラムごとのスコアの調整は、具体的な提案があれば検討する。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
タイトル(issueなら
subject
)にキーワードが含まれていた場合は本文に含まれている場合よりも高いスコアーにして欲しい。理由はタイトルに含まれている方がより目的の項目である可能性が高いから。The text was updated successfully, but these errors were encountered: