Comments (7)
PostgreSQLだとRedmine本体のクエリをそのまま使っているので本体の対応待ちになります。
MariaDB(MySQL)だと、自分でクエリ組み立てているので直せると思います。
from redmine_full_text_search.
自分の利用環境はMariaDBとMySQLです。
検討して頂けると有難いです。
該当処理は↓辺りでしょうか?自分には無理ですが。。
/lib/full_text_search/mroonga.rbの def self.after_save(record)
from redmine_full_text_search.
少し調べてみましたが、Redmine本体側の対応が必須でした。
カスタムフィールドを作るときに「検索対象」かどうか設定可能な種類は「テキスト」、「リスト」、「長いテキスト」の3つだけでした。「キーバリューリスト」は検索対象に指定することができません。
なので、まず「キーバリューリスト」を検索対象に指定できるようにする必要があります。
その後、acts_as_seachable の search_result_ranks_and_ids でクエリを書き換えればいいはずです。
from redmine_full_text_search.
LEFT OUTER JOIN
が必要になるから where で or が簡単に書けない Rails4 だと辛い。
こんな感じのクエリが発行されれば結果は取れる。。。
SELECT DISTINCT
pgroonga.score(issues) AS score,
issues.updated_on AS order_target,
"issues"."id"
FROM "issues"
INNER JOIN "projects"
ON "projects"."id" = "issues"."project_id"
INNER JOIN "custom_values"
ON "custom_values"."customized_id" = "issues"."id" AND "custom_values"."customized_type" = 'Issue'
LEFT JOIN "custom_field_enumerations"
ON "custom_field_enumerations"."custom_field_id" = "custom_values"."custom_field_id" AND custom_field_enumerations.id::text = custom_values.value
WHERE (projects.status <> 9
AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking'))
AND ((custom_values.custom_field_id IN (2,3)
AND (((1=1) AND (issues.tracker_id IN (SELECT tracker_id FROM custom_fields_trackers WHERE custom_field_id = custom_values.custom_field_id))
AND (EXISTS (SELECT 1 FROM custom_fields ifa WHERE ifa.is_for_all = 't' AND ifa.id = custom_values.custom_field_id)
OR issues.project_id IN (SELECT project_id FROM custom_fields_projects WHERE custom_field_id = custom_values.custom_field_id))))))
AND (custom_values.value ILIKE '%作成中%' OR custom_field_enumerations.name ILIKE '%作成中%')
ORDER BY score DESC, "issues"."id" DESC;
from redmine_full_text_search.
>なので、まず「キーバリューリスト」を検索対象に指定できるようにする必要があります。
>その後、acts_as_seachable の search_result_ranks_and_ids でクエリを書き換えればいいはずです。
お手数お掛けしてすみません。
現行のRedmineでは、キーバリューリストの文字列検索自体が未実装ということで了解です。
強引に行う場合、大きくは下記箇所の修正になるでしょうか。
fts_custom_valuesにキーバリューリスト内部の数値が入っているので、
リスト定義内容を後から変更された場合を無視すれば、対応可能かなと思っています。
1.カスタムフィールドの検索指定-キーバリューリストで指定可能にする。
1は検索したいCFについて↓を通過させる。
redmine_full_text_search/lib/full_text_search/mroonga.rb
searchable_custom_fields = ::CustomField.where(:type => "#{self.name}CustomField", :searchable => true).to_a
DB書換でcustom_fields searchable 0->1
2.issue保存時にfts_custom_values に書き込んでいる箇所、
キーバリューリストの検索対象フィールドの場合に、IDではなく文字列を登録する。
class Callbacks
def self.after_save(record)
に変換処理を入れる。
from redmine_full_text_search.
その案だと Mroonga を使っている場合しか対応できませんし、将来 Redmine 本体で対応が入ったときのマイグレーションが困難になるので、やりたくないです。
このプラグインはなるべく本体からの乖離を少なくして Mroonga と Pgroonga に対応させる、という方針で開発しています。
from redmine_full_text_search.
設計方針了解しました。
自分の案は一部環境のみの対応で、好ましい対応方針では無いのは同意です。
Mroongaだけ対応でも役に立つ人は居るでしょうから、
自分でやってみて、動いたらForkして公開します。(時期未定、お勉強&github練習。。)
from redmine_full_text_search.
Related Issues (20)
- ActiveRecord::RecordNotFound (Couldn't find FullTextSearch::TagType with 'id'=0) HOT 3
- migrate error on pgroonga HOT 3
- インストールしようとするとデータベース(Mroonga)のマイグレーションに失敗する HOT 2
- redmine 5.0.2 ruby 3.1.2 HOT 3
- fts_targets records of custom field is not deleted when Issue is deleted HOT 2
- 削除したカスタムフィールドの単語を検索時、エラー HOT 5
- Thinking of OpenAI HOT 1
- データ同期でエラー HOT 11
- 検索結果のソートにチケット番号を追加してほしい HOT 42
- Redmine 5.1 isn't supported HOT 16
- Add support for fuzzy search
- Add test cases for order by last modified time or score HOT 1
- Support for Redmine master with Rails version 7 HOT 2
- Syntax error may be happen
- Asynchronous job for data update
- Search for "rms" results in a 500 error HOT 1
- Exceeds PostgreSQL index size limit HOT 4
- Error on Rails6 HOT 5
- Search Knowledgebase articles HOT 4
- Proposal to improve database recovery procedure HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redmine_full_text_search.