mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 03:13:39 +08:00
FEATURE: Make links indexable. (#6285)
This commit is contained in:
parent
a71fe16647
commit
975a72ab7a
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user