Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/164404
Change subject: Remove autocollapse elements from index
......................................................................
Remove autocollapse elements from index
Autocollapse elements are typically collapsed by default and difficult
for users to see. They are typically not central to the page's content.
So we remove them from the search index.
Bug: 71562
Change-Id: Ibd9cb3e21bd0dd46160bae084ff1b1b72e3093cf
---
M includes/BuildDocument/PageTextBuilder.php
A tests/browser/features/removed_text.feature
M tests/browser/features/support/hooks.rb
3 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/04/164404/1
diff --git a/includes/BuildDocument/PageTextBuilder.php
b/includes/BuildDocument/PageTextBuilder.php
index e7f57b5..6c08822 100644
--- a/includes/BuildDocument/PageTextBuilder.php
+++ b/includes/BuildDocument/PageTextBuilder.php
@@ -33,6 +33,7 @@
'.mw-cite-backlink', // The ↑ next to refenences in the
references section
'h1', 'h2', 'h3', // Headings are already indexed in
their own field.
'h5', 'h6', 'h4',
+ '.autocollapse', // Collapsed fields are hidden by
default so we don't want them showing up.
);
/**
* @var array selectors to elements that are considered auxiliary to
article text for search
diff --git a/tests/browser/features/removed_text.feature
b/tests/browser/features/removed_text.feature
new file mode 100644
index 0000000..0e5d96e
--- /dev/null
+++ b/tests/browser/features/removed_text.feature
@@ -0,0 +1,12 @@
+@clean @phantomjs @setup_main @removed_text
+Feature: Removed text
+ Background:
+ Given I am at a random page
+
+ Scenario: Searching fox text that is inside <video> and <audio> tags doesn't
find it
+ When I search for "JavaScript disabled"
+ Then there are no search results
+
+ Scenario: Searching fox text that is inside autocollapse tags doesn't find it
+ When I search for in autocollapse
+ Then there are no search results
diff --git a/tests/browser/features/support/hooks.rb
b/tests/browser/features/support/hooks.rb
index 9dd47a8..8577893 100644
--- a/tests/browser/features/support/hooks.rb
+++ b/tests/browser/features/support/hooks.rb
@@ -540,3 +540,13 @@
linksto = true
end
end
+
+removed_text = false
+Before("@removed_text") do
+ unless removed_text
+ steps %(
+ Given a page named Autocollapse Example exists with contents <div
class="autocollapse">in autocollapse</div>
+ )
+ removed_text = true
+ end
+end
--
To view, visit https://gerrit.wikimedia.org/r/164404
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd9cb3e21bd0dd46160bae084ff1b1b72e3093cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits