diff --git a/modules/wikis/app/services/wikis/adapters/providers/xwiki/queries/search_pages.rb b/modules/wikis/app/services/wikis/adapters/providers/xwiki/queries/search_pages.rb index 3a44dce9a1e..9029f99636f 100644 --- a/modules/wikis/app/services/wikis/adapters/providers/xwiki/queries/search_pages.rb +++ b/modules/wikis/app/services/wikis/adapters/providers/xwiki/queries/search_pages.rb @@ -36,7 +36,9 @@ module Wikis class SearchPages < BaseQuery include Concerns::XWikiQuery - MAXIMUM_RESULTS = 50 + # Limiting result size rather strictly, because each result will cause another HTTP call to XWiki, this does not + # scale well. A stricter limit improves the worst case latency. + MAXIMUM_RESULTS = 20 def call(input_data:, auth_strategy:) query = { q: "\"#{escape_quotes input_data.query}\"", number: MAXIMUM_RESULTS } diff --git a/spec/support/fixtures/vcr_cassettes/xwiki/query_exact_match.yml b/spec/support/fixtures/vcr_cassettes/xwiki/query_exact_match.yml index 8791bef049a..782f6749212 100644 --- a/spec/support/fixtures/vcr_cassettes/xwiki/query_exact_match.yml +++ b/spec/support/fixtures/vcr_cassettes/xwiki/query_exact_match.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://xwiki.local/rest/wikis/query?number=50&q=%22Test%20Page%20for%20RSpec%22 + uri: https://xwiki.local/rest/wikis/query?number=20&q=%22Test%20Page%20for%20RSpec%22 body: encoding: US-ASCII string: '' @@ -27,9 +27,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:19 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=EF2A09F6E0681B4B0B3E44D639CB89D9; Path=/; HttpOnly + - JSESSIONID=86BECC608B1C5FD09A32A74836CAEA4E; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -42,8 +42,8 @@ http_interactions: encoding: UTF-8 string: '{"links":[],"searchResults":[{"links":[{"href":"https://xwiki.local/rest/wikis/xwiki/spaces/Test%20Page/pages/WebHome","rel":"http://www.xwiki.org/rel/page","type":null,"hrefLang":null}],"type":"page","id":"xwiki:Test Page.WebHome","pageFullName":"Test Page.WebHome","title":"Test Page for RSpec","wiki":"xwiki","space":"Test - Page","pageName":"WebHome","modified":1780386902000,"author":"xwiki:XWiki.admin","authorName":null,"version":"4.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":32.03692,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' - recorded_at: Fri, 05 Jun 2026 06:39:19 GMT + Page","pageName":"WebHome","modified":1780386902000,"author":"xwiki:XWiki.admin","authorName":null,"version":"4.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":36.06842,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT - request: method: put uri: https://xwiki.local/rest/openproject/documents?docRef=xwiki:Test%20Page.WebHome @@ -75,9 +75,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:19 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=CD75D58F42FA2FF29480F0AA679975CB; Path=/; HttpOnly + - JSESSIONID=D0C7401B4A9ADC6FF35E556801B050B3; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -94,5 +94,5 @@ http_interactions: URL Shortener.","content":"This is a test page that I created with my own hands.","clazz":null,"objects":null,"attachments":null,"hierarchy":{"items":[{"label":"xwiki","name":"xwiki","type":"wiki","url":"https://xwiki.local/bin/view/Main/"},{"label":"Test Page","name":"Test Page","type":"space","url":"https://xwiki.local/bin/view/Test%20Page/"},{"label":"WebHome","name":"WebHome","type":"document","url":"https://xwiki.local/bin/view/Test%20Page/"}]},"rights":[],"renderedContent":null}' - recorded_at: Fri, 05 Jun 2026 06:39:19 GMT + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT recorded_with: VCR 6.4.0 diff --git a/spec/support/fixtures/vcr_cassettes/xwiki/query_no_match.yml b/spec/support/fixtures/vcr_cassettes/xwiki/query_no_match.yml index c1158559d9d..1f75478d02f 100644 --- a/spec/support/fixtures/vcr_cassettes/xwiki/query_no_match.yml +++ b/spec/support/fixtures/vcr_cassettes/xwiki/query_no_match.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://xwiki.local/rest/wikis/query?number=50&q=%22A%20page%20that%20does%20not%20exist%22 + uri: https://xwiki.local/rest/wikis/query?number=20&q=%22A%20page%20that%20does%20not%20exist%22 body: encoding: US-ASCII string: '' @@ -27,9 +27,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:20 GMT + - Fri, 05 Jun 2026 08:53:31 GMT Set-Cookie: - - JSESSIONID=D1B7C7CFA5520362BCB9E2DB63EFCE00; Path=/; HttpOnly + - JSESSIONID=732467DE0A76FD79B8958EC80B2E9BB2; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -41,5 +41,5 @@ http_interactions: body: encoding: UTF-8 string: '{"links":[],"searchResults":[],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' - recorded_at: Fri, 05 Jun 2026 06:39:20 GMT + recorded_at: Fri, 05 Jun 2026 08:53:31 GMT recorded_with: VCR 6.4.0 diff --git a/spec/support/fixtures/vcr_cassettes/xwiki/query_partial_match.yml b/spec/support/fixtures/vcr_cassettes/xwiki/query_partial_match.yml index a78c9afd3d3..0419190f295 100644 --- a/spec/support/fixtures/vcr_cassettes/xwiki/query_partial_match.yml +++ b/spec/support/fixtures/vcr_cassettes/xwiki/query_partial_match.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://xwiki.local/rest/wikis/query?number=50&q=%22for%20RSpec%22 + uri: https://xwiki.local/rest/wikis/query?number=20&q=%22for%20RSpec%22 body: encoding: US-ASCII string: '' @@ -27,9 +27,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:19 GMT + - Fri, 05 Jun 2026 08:53:31 GMT Set-Cookie: - - JSESSIONID=689FB3235B4E5A8C46683A1331BD9EB2; Path=/; HttpOnly + - JSESSIONID=61B575D9D2898F806A6569BC6F465501; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -42,8 +42,8 @@ http_interactions: encoding: UTF-8 string: '{"links":[],"searchResults":[{"links":[{"href":"https://xwiki.local/rest/wikis/xwiki/spaces/Test%20Page/pages/WebHome","rel":"http://www.xwiki.org/rel/page","type":null,"hrefLang":null}],"type":"page","id":"xwiki:Test Page.WebHome","pageFullName":"Test Page.WebHome","title":"Test Page for RSpec","wiki":"xwiki","space":"Test - Page","pageName":"WebHome","modified":1780386902000,"author":"xwiki:XWiki.admin","authorName":null,"version":"4.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":14.085169,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' - recorded_at: Fri, 05 Jun 2026 06:39:19 GMT + Page","pageName":"WebHome","modified":1780386902000,"author":"xwiki:XWiki.admin","authorName":null,"version":"4.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":15.390617,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' + recorded_at: Fri, 05 Jun 2026 08:53:31 GMT - request: method: put uri: https://xwiki.local/rest/openproject/documents?docRef=xwiki:Test%20Page.WebHome @@ -75,9 +75,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:19 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=41BB94B7774F3AAF5872EC50FF78C37B; Path=/; HttpOnly + - JSESSIONID=753A9D110C6DC9393E3350EA056BBC05; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -94,5 +94,5 @@ http_interactions: URL Shortener.","content":"This is a test page that I created with my own hands.","clazz":null,"objects":null,"attachments":null,"hierarchy":{"items":[{"label":"xwiki","name":"xwiki","type":"wiki","url":"https://xwiki.local/bin/view/Main/"},{"label":"Test Page","name":"Test Page","type":"space","url":"https://xwiki.local/bin/view/Test%20Page/"},{"label":"WebHome","name":"WebHome","type":"document","url":"https://xwiki.local/bin/view/Test%20Page/"}]},"rights":[],"renderedContent":null}' - recorded_at: Fri, 05 Jun 2026 06:39:19 GMT + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT recorded_with: VCR 6.4.0 diff --git a/spec/support/fixtures/vcr_cassettes/xwiki/query_quoted_match.yml b/spec/support/fixtures/vcr_cassettes/xwiki/query_quoted_match.yml index b1238e1edde..b2f28f954e0 100644 --- a/spec/support/fixtures/vcr_cassettes/xwiki/query_quoted_match.yml +++ b/spec/support/fixtures/vcr_cassettes/xwiki/query_quoted_match.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://xwiki.local/rest/wikis/query?number=50&q=%22%5C%22Quoted%5C%22%20pages%20can%20be%20tricky%22 + uri: https://xwiki.local/rest/wikis/query?number=20&q=%22%5C%22Quoted%5C%22%20pages%20can%20be%20tricky%22 body: encoding: US-ASCII string: '' @@ -27,9 +27,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:20 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=A1B5B0EFF5FD5E7B4F6E4CB0D185B065; Path=/; HttpOnly + - JSESSIONID=0A832E95AF62319A728E2D94FF402FD2; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -37,13 +37,13 @@ http_interactions: Xwiki-Version: - 18.3.0 Content-Length: - - '893' + - '891' body: encoding: UTF-8 string: '{"links":[],"searchResults":[{"links":[{"href":"https://xwiki.local/rest/wikis/xwiki/spaces/%22Quoted%22%20pages%20can%20be%20tricky/pages/WebHome","rel":"http://www.xwiki.org/rel/page","type":null,"hrefLang":null}],"type":"page","id":"xwiki:\"Quoted\" pages can be tricky.WebHome","pageFullName":"\"Quoted\" pages can be tricky.WebHome","title":"\"Quoted\" - pages can be tricky","wiki":"xwiki","space":"\"Quoted\" pages can be tricky","pageName":"WebHome","modified":1780387197000,"author":"xwiki:XWiki.admin","authorName":null,"version":"1.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":41.692856,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' - recorded_at: Fri, 05 Jun 2026 06:39:20 GMT + pages can be tricky","wiki":"xwiki","space":"\"Quoted\" pages can be tricky","pageName":"WebHome","modified":1780387197000,"author":"xwiki:XWiki.admin","authorName":null,"version":"1.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":46.0744,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT - request: method: put uri: https://xwiki.local/rest/openproject/documents?docRef=xwiki:%22Quoted%22%20pages%20can%20be%20tricky.WebHome @@ -75,9 +75,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:20 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=9F577E6A3744F626EDDD3668B5F9EE9D; Path=/; HttpOnly + - JSESSIONID=8074F7A06BEFB236927D7E9858A4D266; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -95,5 +95,5 @@ http_interactions: URL Shortener.","content":"When the page title contains quotes, it''s harder to exactly match their page title.","clazz":null,"objects":null,"attachments":null,"hierarchy":{"items":[{"label":"xwiki","name":"xwiki","type":"wiki","url":"https://xwiki.local/bin/view/Main/"},{"label":"\"Quoted\" pages can be tricky","name":"\"Quoted\" pages can be tricky","type":"space","url":"https://xwiki.local/bin/view/%22Quoted%22%20pages%20can%20be%20tricky/"},{"label":"WebHome","name":"WebHome","type":"document","url":"https://xwiki.local/bin/view/%22Quoted%22%20pages%20can%20be%20tricky/"}]},"rights":[],"renderedContent":null}' - recorded_at: Fri, 05 Jun 2026 06:39:20 GMT + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT recorded_with: VCR 6.4.0 diff --git a/spec/support/fixtures/vcr_cassettes/xwiki/query_unquoted_match.yml b/spec/support/fixtures/vcr_cassettes/xwiki/query_unquoted_match.yml index c46c68fc370..9e9fbe26be3 100644 --- a/spec/support/fixtures/vcr_cassettes/xwiki/query_unquoted_match.yml +++ b/spec/support/fixtures/vcr_cassettes/xwiki/query_unquoted_match.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://xwiki.local/rest/wikis/query?number=50&q=%22Quoted%20pages%20can%20be%20tricky%22 + uri: https://xwiki.local/rest/wikis/query?number=20&q=%22Quoted%20pages%20can%20be%20tricky%22 body: encoding: US-ASCII string: '' @@ -27,9 +27,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:20 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=B47446E1E06E6D2A73FC512CEAB8083D; Path=/; HttpOnly + - JSESSIONID=85EDC4821BCF449B0D29798F3AD7D750; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -37,13 +37,13 @@ http_interactions: Xwiki-Version: - 18.3.0 Content-Length: - - '893' + - '891' body: encoding: UTF-8 string: '{"links":[],"searchResults":[{"links":[{"href":"https://xwiki.local/rest/wikis/xwiki/spaces/%22Quoted%22%20pages%20can%20be%20tricky/pages/WebHome","rel":"http://www.xwiki.org/rel/page","type":null,"hrefLang":null}],"type":"page","id":"xwiki:\"Quoted\" pages can be tricky.WebHome","pageFullName":"\"Quoted\" pages can be tricky.WebHome","title":"\"Quoted\" - pages can be tricky","wiki":"xwiki","space":"\"Quoted\" pages can be tricky","pageName":"WebHome","modified":1780387197000,"author":"xwiki:XWiki.admin","authorName":null,"version":"1.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":41.692856,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' - recorded_at: Fri, 05 Jun 2026 06:39:20 GMT + pages can be tricky","wiki":"xwiki","space":"\"Quoted\" pages can be tricky","pageName":"WebHome","modified":1780387197000,"author":"xwiki:XWiki.admin","authorName":null,"version":"1.1","language":null,"className":null,"objectNumber":null,"filename":null,"score":46.0744,"object":null,"hierarchy":null}],"template":"https://xwiki.local/rest/?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})"}' + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT - request: method: put uri: https://xwiki.local/rest/openproject/documents?docRef=xwiki:%22Quoted%22%20pages%20can%20be%20tricky.WebHome @@ -75,9 +75,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Date: - - Fri, 05 Jun 2026 06:39:20 GMT + - Fri, 05 Jun 2026 08:53:32 GMT Set-Cookie: - - JSESSIONID=2B1297828F8D8887496627F7356421D5; Path=/; HttpOnly + - JSESSIONID=6C4E5F9B0CF3BAD764856C1C7DD0F8DD; Path=/; HttpOnly Xwiki-Form-Token: - ON8xsHlEpixyujzpUPNupg Xwiki-User: @@ -95,5 +95,5 @@ http_interactions: URL Shortener.","content":"When the page title contains quotes, it''s harder to exactly match their page title.","clazz":null,"objects":null,"attachments":null,"hierarchy":{"items":[{"label":"xwiki","name":"xwiki","type":"wiki","url":"https://xwiki.local/bin/view/Main/"},{"label":"\"Quoted\" pages can be tricky","name":"\"Quoted\" pages can be tricky","type":"space","url":"https://xwiki.local/bin/view/%22Quoted%22%20pages%20can%20be%20tricky/"},{"label":"WebHome","name":"WebHome","type":"document","url":"https://xwiki.local/bin/view/%22Quoted%22%20pages%20can%20be%20tricky/"}]},"rights":[],"renderedContent":null}' - recorded_at: Fri, 05 Jun 2026 06:39:20 GMT + recorded_at: Fri, 05 Jun 2026 08:53:32 GMT recorded_with: VCR 6.4.0