DCausse has uploaded a new change for review.
https://gerrit.wikimedia.org/r/293095
Change subject: Add some tests for search profile selection
......................................................................
Add some tests for search profile selection
Change-Id: Ieb620bdede1da49fb772ff31373aa917e017b1ab
---
M tests/browser/features/prefix_search_api.feature
M tests/browser/features/relevancy_api.feature
M tests/browser/features/step_definitions/search_steps.rb
M tests/browser/features/support/cirrus_search_api_helper.rb
M tests/browser/features/support/hooks.rb
5 files changed, 36 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/95/293095/1
diff --git a/tests/browser/features/prefix_search_api.feature
b/tests/browser/features/prefix_search_api.feature
index f4d8171..b6c7e54 100644
--- a/tests/browser/features/prefix_search_api.feature
+++ b/tests/browser/features/prefix_search_api.feature
@@ -115,6 +115,33 @@
| Mo:Test | Mó:Test | Mó:Test
|
| file:Mo:Test | none | none
|
+ Scenario Outline: Search suggestions with various profiles
+ When I get api suggestions for <term> using the <profile> profile
+ Then <result>
+ And the api should offer to search for pages containing <term>
+ Examples:
+ | term | profile | result |
+ | África | strict | África is the first api suggestion |
+ | Africa | strict | the API should produce list of length 0 |
+ | Agrica | strict | the API should produce list of length 0 |
+ | África | normal | África is the first api suggestion |
+ | Africa | normal | África is the first api suggestion |
+ | Agrica | normal | the API should produce list of length 0 |
+ | África | classic | África is the first api suggestion |
+ | Africa | classic | África is the first api suggestion |
+ | Agrica | classic | África is the first api suggestion |
+ | África | fuzzy | the API should produce list of length 0 |
+ | Africa | fuzzy | África is the first api suggestion |
+ | Agrica | fuzzy | África is the first api suggestion |
+ | doors | strict | the API should produce list of length 0 |
+ | doors | classic | the API should produce list of length 0 |
+ | doors | normal | The Doors is the first api suggestion |
+ | the doors | normal | The Doors is the first api suggestion |
+ | thedoors | normal | the API should produce list of length 0 |
+ | doors | fuzzy | The Doors is the first api suggestion |
+ | the doors | fuzzy | The Doors is the first api suggestion |
+ | thedoors | fuzzy | The Doors is the first api suggestion |
+
# Just take too long to run on a regular basis
# @redirect @huge
# Scenario: Prefix search on pages with tons of redirects is reasonably fast
diff --git a/tests/browser/features/relevancy_api.feature
b/tests/browser/features/relevancy_api.feature
index 69dc2bc..88ce0fb 100644
--- a/tests/browser/features/relevancy_api.feature
+++ b/tests/browser/features/relevancy_api.feature
@@ -37,7 +37,7 @@
# created. It gets its position updated by the link counting job which has
to wait for refreshing and undelaying.
Scenario: Results are sorted based on what part of the page matches: title,
redirect, category, etc
- When I api search with disabled incoming link weighting for Relevancytest
+ When I api search with query independent profile classic_noboostlinks for
Relevancytest
Then Relevancytest is the first api search result
And Relevancytestviaredirect is the second api search result
And Relevancytestviacategory is the third api search result
@@ -47,7 +47,7 @@
And Relevancytestviaauxtext is the sixth or seventh api search result
Scenario: Results are sorted based on what part of the page matches: title,
redirect, category, etc
- When I api search with disabled incoming link weighting for
"Relevancytestphrase phrase"
+ When I api search with query independent profile classic_noboostlinks for
"Relevancytestphrase phrase"
Then Relevancytestphrase phrase is the first api search result
And Relevancytestphraseviaredirect is the second api search result
And Relevancytestphraseviacategory is the third api search result
@@ -70,7 +70,7 @@
And a page named Relevancylinktest Larger/Link C exists with contents
[[Relevancylinktest Larger Extraword]]
And a page named Relevancylinktest Larger/Link D exists with contents
[[Relevancylinktest Larger Extraword]]
When within 20 seconds api searching for Relevancylinktest -intitle:link
yields Relevancylinktest Larger Extraword as the first result and
Relevancylinktest Smaller as the second result
- And I api search with disabled incoming link weighting for
Relevancylinktest -intitle:link
+ And I api search with query independent profile classic_noboostlinks for
Relevancylinktest -intitle:link
Then Relevancylinktest Smaller is the first api search result
And Relevancylinktest Larger Extraword is the second api search result
# This test can fail spuriously for the same reasons that "Redirects count
as incoming links" can fail
@@ -93,13 +93,13 @@
Scenario: Results are sorted based on how close the match is
- When I api search with disabled incoming link weighting for
Relevancyclosetest Foô
+ When I api search with query independent profile classic_noboostlinks for
Relevancyclosetest Foô
Then Relevancyclosetest Foô is the first api search result
And Relevancyclosetest Foo is the second api search result
And Foo Relevancyclosetest is the third api search result
Scenario: Results are sorted based on how close the match is (backwards this
time)
- When I api search with disabled incoming link weighting for
Relevancyclosetest Foo
+ When I api search with query independent profile classic_noboostlinks for
Relevancyclosetest Foo
Then Relevancyclosetest Foo is the first api search result
And Relevancyclosetest Foô is the second api search result
And Foo Relevancyclosetest is the third api search result
diff --git a/tests/browser/features/step_definitions/search_steps.rb
b/tests/browser/features/step_definitions/search_steps.rb
index d7bc084..2320075 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -22,15 +22,15 @@
@didyoumean_options[varname] = value
end
-When(/^I api search( with rewrites enabled)?( with disabled incoming link
weighting)?(?: with offset (\d+))?(?: in the (.*) language)?(?: in namespaces?
(\d+(?: \d+)*))? for (.*)$/) do |enable_rewrites, incoming_links, offset, lang,
namespaces, search|
+When(/^I api search( with rewrites enabled)?(?: with query independent profile
([^ ]+))?(?: with offset (\d+))?(?: in the (.*) language)?(?: in namespaces?
(\d+(?: \d+)*))? for (.*)$/) do |enable_rewrites, qiprofile, offset, lang,
namespaces, search|
begin
options = {
sroffset: offset,
srnamespace: (namespaces || "0").split(/ /),
uselang: lang,
- cirrusBoostLinks: incoming_links ? "no" : "yes",
enablerewrites: enable_rewrites ? 1 : 0
}
+ options["srqiprofile"] = qiprofile if qiprofile
options = options.merge(@didyoumean_options) if defined?@didyoumean_options
@api_result = search_for(
diff --git a/tests/browser/features/support/cirrus_search_api_helper.rb
b/tests/browser/features/support/cirrus_search_api_helper.rb
index 48edc80..41e95cd 100644
--- a/tests/browser/features/support/cirrus_search_api_helper.rb
+++ b/tests/browser/features/support/cirrus_search_api_helper.rb
@@ -48,8 +48,7 @@
api.action(
:opensearch,
search: search,
- # TODO: support new profile API param when added.
- cirrusUseCompletionSuggester: profile == "classic" ? "no" : "yes",
+ profile: profile,
token_type: false
)
end
diff --git a/tests/browser/features/support/hooks.rb
b/tests/browser/features/support/hooks.rb
index 1351f6f..37bcd39 100644
--- a/tests/browser/features/support/hooks.rb
+++ b/tests/browser/features/support/hooks.rb
@@ -654,6 +654,7 @@
And a page named Venom exists with contents Venom, or the Venom
Symbiote, is a fictional supervillain appearing in American comic books
published by Marvel Comics
And a page named Sam Wilson exists with contents Warren Kenneth
Worthington III, originally known as Angel and later as Archangel, is a
fictional superhero appearing in American comic books published by Marvel
Comics like [[Venom]].
And a page named Zam Wilson exists with contents #REDIRECT [[Sam
Wilson]]
+ And a page named The Doors exists with contents The Doors were an
American rock band formed in 1965 in Los Angeles.
And I reindex suggestions
)
suggest = true
--
To view, visit https://gerrit.wikimedia.org/r/293095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb620bdede1da49fb772ff31373aa917e017b1ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits