FEATURE: Make links indexable. (#6285)

This commit is contained in:
Bianca Nenciu 2018-08-20 02:39:19 +02:00 committed by Sam
parent a71fe16647
commit 975a72ab7a
2 changed files with 13 additions and 0 deletions

View File

@ -201,6 +201,11 @@ class SearchIndexer
scrubbed << attributes["data-youtube-title"]
scrubbed << " "
end
if attributes["href"]
scrubbed << " "
scrubbed << attributes["href"]
scrubbed << " "
end
end
def characters(string)

View File

@ -21,6 +21,14 @@ describe SearchIndexer do
expect(scrubbed).to eq(" Metallica Mixer Explains Missing Bass on 'And Justice for All' [Exclusive] ")
end
it 'extract a link' do
html = "<a href='http://meta.discourse.org/'>link</a>"
scrubbed = SearchIndexer::HtmlScrubber.scrub(html)
expect(scrubbed).to eq(" http://meta.discourse.org/ link ")
end
it 'correctly indexes a post according to version' do
# Preparing so that they can be indexed to right version
SearchIndexer.update_posts_index(post_id, "dummy", "", nil, nil)