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 << attributes["data-youtube-title"]
scrubbed << " " scrubbed << " "
end end
if attributes["href"]
scrubbed << " "
scrubbed << attributes["href"]
scrubbed << " "
end
end end
def characters(string) 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] ") expect(scrubbed).to eq(" Metallica Mixer Explains Missing Bass on 'And Justice for All' [Exclusive] ")
end 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 it 'correctly indexes a post according to version' do
# Preparing so that they can be indexed to right version # Preparing so that they can be indexed to right version
SearchIndexer.update_posts_index(post_id, "dummy", "", nil, nil) SearchIndexer.update_posts_index(post_id, "dummy", "", nil, nil)