FEATURE: index YouTube titles in search
Previously we omitted the titles for videos that YouTube provided
This commit is contained in:
parent
55179efdb9
commit
6676bbd38b
|
@ -196,6 +196,11 @@ class SearchIndexer
|
|||
scrubbed << attributes["title"]
|
||||
scrubbed << " "
|
||||
end
|
||||
if attributes["data-youtube-title"]
|
||||
scrubbed << " "
|
||||
scrubbed << attributes["data-youtube-title"]
|
||||
scrubbed << " "
|
||||
end
|
||||
end
|
||||
|
||||
def characters(string)
|
||||
|
|
|
@ -13,6 +13,14 @@ describe SearchIndexer do
|
|||
expect(raw_data.split(' ').length).to eq(2)
|
||||
end
|
||||
|
||||
it 'extract youtube title' do
|
||||
html = "<div class=\"lazyYT\" data-youtube-id=\"lmFgeFh2nlw\" data-youtube-title=\"Metallica Mixer Explains Missing Bass on 'And Justice for All' [Exclusive]\" data-width=\"480\" data-height=\"270\" data-parameters=\"feature=oembed&wmode=opaque\"></div>"
|
||||
|
||||
scrubbed = SearchIndexer::HtmlScrubber.scrub(html)
|
||||
|
||||
expect(scrubbed).to eq(" Metallica Mixer Explains Missing Bass on 'And Justice for All' [Exclusive] ")
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue