Closed HashidaTKS closed 1 year ago
We should remove entries that refer nonexistent Redmine records instead of not touching them on search.
Thanks! I will try to fix current changes to remove entries that refer nonexistent records.
Concern: This changes don't remove already left fts records. (The error is not resolved only apply this changes, already left fts records should be removed.)
Concern: This changes don't remove already left fts records. (The error is not resolved only apply this changes, already left fts records should be removed.)
When we should remove the already left (orphan) fts records? I thinks 2. is better.
@kou
Would you review this when you have time? Do you have any good idea for https://github.com/clear-code/redmine_full_text_search/pull/109#issuecomment-1410062309 ?
bin/rails full_text_search:synchronize
removes orphan FullTextSearch::Target
.
GitHub: fix GH-108
If a searchable
CustomField
is destroyed, correspondingFullTextSearch::Target
records are also destroyed. We can't use existing mapper mechanism for it becauseCustomField
useshas_many :custom_values, :dependent => :delete_all
relation. It doesn't callafter_destroy
callback that is needed to synchronizeCustomFieldValue
andFullTextSearch::Target
.We can remove orphaned
FullTextSearch::Target
for destroyedCustomFieldValue
bybin/rails full_text_search:synchronize
.