dtext links: allow searching for forum posts linking to specific tag.

This commit is contained in:
evazion
2019-10-27 01:05:54 -05:00
parent d946a84480
commit d617b20b49
7 changed files with 55 additions and 20 deletions

View File

@@ -7,17 +7,28 @@ require_relative "../../config/environment"
# wiki_page.save!(touch: false, validate: false)
# end
def reindex
def reindex_wiki_pages
WikiPage.find_in_batches(batch_size: 500) do |wiki_pages|
WikiPage.transaction do
wiki_pages.each do |wiki_page|
DtextLink.new_from_dtext(wiki_page.body).each do |link|
link.model = wiki_page
link.save!(touch: false, validate: false)
link.save!
end
end
end
end
end
reindex
def reindex_forum_posts
ForumPost.find_in_batches(batch_size: 500) do |forum_posts|
ForumPost.transaction do
forum_posts.each do |forum_post|
DtextLink.new_from_dtext(forum_post.body).each do |link|
link.model = forum_post
link.save!
end
end
end
end
end