Commit graph

9 commits

Author SHA1 Message Date
aude
515c81b048 Skip adding wikitext test pages in PrefixSearchTest if NS_MAIN is not wikitext
these tests get skipped and so should adding these pages, since it
leads to a fatal error and inability to run tests on such a wiki.

Bug: T97416
Change-Id: Icc4e325ecbc5ed069d12bbad686812f6a45b47e7
2015-08-14 11:32:08 +02:00
Timo Tijhof
d66269ad2d PrefixSearchTest: Move insertPage() from setUp() to addDBData()
Doesn't change the semantics much since run() calls addDBData()
right before setUp(), but these belong addDBData() per the
documentation of setUp().

Change-Id: I304a0aff1fc6b2f0541b3dc3c9e3527772c8f91c
2015-03-25 19:10:40 +00:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
Chad Horohoe
b702cb3b24 Support offsets in prefix searching
Fixes T75522
Change-Id: I7a27a64e295a1efcb1d9728d95cf254bb8bfbe92
2014-12-02 11:59:26 -08:00
Nik Everett
2ec9915816 Handle redirects during prefix search exact match
Prefix search attempts to find exact matches to the user's query that aren't
returned by plugins.  In some cases, like when the exact match is a redirect
and the target of the redirect is also in the search results, it would result
in multiple results in prefix search going the same place.  This looks really
silly when the top hit is "Barack obama" (a redirect) and the next one is
"Barack Obama" (the target of the redirect).

This handles a bunch of cases to do with redirects in the matches and when
the exact match is a redirect.

Bug: 736731
Change-Id: I49fe1ccec84bd5d1f44c6b91b260abf50f2cc3a1
2014-11-21 14:47:32 -05:00
umherirrender
ac79e19024 Make PrefixSearchTest use MediaWikiLangTestCase
It uses namespaces which depends on the content language

Change-Id: I0a1ef4adea1e1ddff32e37cbbd8cf51a3398905b
2014-10-20 14:17:41 +00:00
aude
cb576ef0b0 Skip tests in PrefixSearchTest if not wikitext main namespace
Otherwise, running core tests with non-wikitext in the main
namespace fail with fatal error.

Change-Id: I895e7ee61ba80c0c345b6c05f05d05c368e52d59
2014-10-18 14:56:19 +02:00
Timo Tijhof
8dd95a13e3 PrefixSearch: Enforce including the exact match as first result
The default search backend implements proper prefix search and
does this naturally. But extensions providing search backends
like Lucene and CirrusSearch actually fail to implement proper
prefix searching and instead use their search engine ranking for
prefix search as well. Thus often the exact match is not on top
or is not even in the first 10 results at all.

On en.wikipedia.org:

> Example
1. "Example (musician)"
2. "Example"
3. "Example.com"

> John ive
1. "John Ives"
2. "John Ivey"
3. "John Ive"

> Foo
1. "Football (soccer)"
2. "Football League Cup"
3. "Foot (length)"

"Foo" exists but is NOT among the returned results.

Bug: 70958
Change-Id: I78d419424baf43d38beeb6dabfc347f430fa45f6
2014-10-10 19:32:09 +00:00
Timo Tijhof
9e3e9e28d4 PrefixSearch: Add unit tests for StringPrefixSearch
Change-Id: If0fa66b212f70ea39d2e7feec117930fcd1b9642
2014-09-23 11:35:27 -07:00