Commit graph

314 commits

Author SHA1 Message Date
Thiemo Mättig
fa15c98787 Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
2017-12-28 16:31:56 +01:00
Huji Lee
e74bfe13f6 Require indentation of CASE statements in PHP code
Bug: T182546
Change-Id: I91a9555893a08e4ec58da97c6cc4d1e70000ff6b
2017-12-10 22:07:50 -05:00
jenkins-bot
03cd9495a4 Merge "Fix a few minor mistakes in PHPDoc tags" 2017-09-15 19:18:17 +00:00
Thiemo Mättig
7301b2514e Fix a few minor mistakes in PHPDoc tags
Change-Id: I2d5f876c9945ba21f8748562230170e3c7ea2ff2
2017-09-15 11:17:17 +02:00
Umherirrender
f739a8f368 Improve some parameter docs
Add missing @return and @param to function docs and fixed some @param

Change-Id: I810727961057cfdcc274428b239af5975c57468d
2017-09-10 20:32:31 +02:00
Umherirrender
9b8b314992 Fix spacing for @param and indent of function comments
In phpcs.xml rename renamed sniffs and add the failing sniffs,
because now the whole sniff is no longer excluded.

Change-Id: If5b0bd16028761abc2c47ace9e97d37ad14bb36f
2017-08-15 14:33:29 +00:00
jenkins-bot
cc4115e87f Merge "Add missing @param and @return documentation" 2017-08-11 21:32:58 +00:00
jenkins-bot
84b6d5c2e5 Merge "Add missing type to @param documentation" 2017-08-11 21:31:51 +00:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Umherirrender
718e63694d Add missing @param and @return documentation
Change-Id: I1d1098eec3933df6561cceef646576013ddc08c8
2017-08-11 22:17:01 +02:00
Umherirrender
5544cef16b Add missing type to @param documentation
Change-Id: I6b2c9c7af9a281fe457099cc3a336a60a25e74aa
2017-08-11 20:37:35 +02:00
Umherirrender
ace44e2064 Use correct variable name in @param documentation
For some varargs a variable name is added with suffix ,... as seen for
many other varargs

Some @param are swapped, because there are in the wrong order

Enable Sniff MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Change-Id: I60fec6025bce824d5c67563ab7b65ad6cd628ad8
2017-08-11 19:27:19 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Umherirrender
bf61a77431 Change @inheritdoc to @inheritDoc
Only @inheritDoc works for the Sniff
MediaWiki.Commenting.FunctionComment

Change-Id: I91fc02cda6701d790e4334fc2bc47f230955545c
2017-08-11 16:49:52 +02:00
jenkins-bot
e72303c9f3 Merge "Remove auto-generated "Constructor" documentation on constructors" 2017-07-21 13:19:44 +00:00
Thiemo Mättig
91a920fd85 Remove auto-generated "Constructor" documentation on constructors
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.

This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".

Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
2017-07-21 12:19:30 +02:00
jenkins-bot
598a250b71 Merge "Support custom offsets from SearchResultSet" 2017-07-19 10:57:28 +00:00
Erik Bernhardson
7fd6ef9ca5 Support custom offsets from SearchResultSet
Work to support interleaved AB testing of search will display
interleaved results of two search configurations on the first page of
results, but standard results on all pages other than the first page.
This means that while 20 results may be requested, the next 'new' result
of the primary query may be at position 10. Allow the SearchResultSet
to declare what the new offset is.

Bug: T150032
Change-Id: I14c0c33249fcdb66f72f5966e2aa72781a34daee
2017-07-18 21:22:49 -07:00
Thiemo Mättig
d14faa6bed Remove auto-generated "Constructor" documentation on constructors
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.

Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
2017-07-10 10:15:51 +00:00
jenkins-bot
e0f53bfb8d Merge "Fix phrase search" 2017-07-05 18:35:16 +00:00
David Causse
187ada1cf4 Fix phrase search
Partially revert I61dc536 that broke phrase search support.

Fix phrase search by making explicit that there are two
kind of legalSearchChars() usecases :

- the chars allowed to be part of the search query (including special
  syntax chars such as " and *). Used by SearchDatabase::filter() to
  cleanup the whole query string (the default).

- the chars allowed to be part of a search term (excluding special
  syntax chars) Used by search engine implementaions when parsing with
  a regex.

For future reference:
Originally this distinction was made "explicit" by calling directly
SearchEngine::legalSearchChars() during the parsing stage. This was
broken by Iaabc10c by enabling inheritance.
This patch adds a new optional param to legalSearchChars to make this
more explicit.

Also remove the function I introduced in I61dc536 (I wrongly assumed
that the disctinction made between legalSearchChars usecases was due
to a difference in behavior between indexing and searching).

Added more tests to prevent this from happening in the future.

Bug: T167798
Change-Id: Ibdc796bb2881a2ed8194099d8c9f491980010f0f
2017-07-03 11:44:48 +02:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
jenkins-bot
0e25b05028 Merge "Add SearchIndexField::getEngineHints()" 2017-06-28 20:37:13 +00:00
jenkins-bot
01c3bf3431 Merge "Fix highlighting for phrase queries" 2017-06-27 23:44:27 +00:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
David Causse
f230f5dcc7 Fix highlighting for phrase queries
I think the bug was introduced during a cleanup in Iaabc10c.
I don't think that " should be part of the legalSearchChars at query
time, it seems to break the regex.
The strategy here is to distinguish legalSearchChars used query time vs
the ones used at index time by introducing:
SearchEngine::legalSearchCharsForUpdate()

Bug: T167798
Change-Id: I61dc53665e26d3c6c48caed78dd3bbde9a33def7
2017-06-26 09:53:13 +02:00
David Causse
b5aecfabd9 Add SearchIndexField::getEngineHints()
Allows search engine clients that implement custom definitions
to pass engine hints used at index time.
Hints are a way to fine tune the behavior of the search engine
when handling a particular field.
As of now this is introduced for CirrusSearch to let SearchIndexField
implementations to control how the noop script is configured.
The noop hint with CirrusSearch allows to (for example):
- ignore an update if a numeric value does not change for more than X%
- control the merge strategy of complex fields

Bug: T166589
Change-Id: Ia560e41d33013c30ac47e5a60543f8cb133e61fb
2017-06-22 16:03:01 +02:00
Paladox
54c56da85a Fix php code style
Preparation change for updating mediawiki code sniffer to 0.8.0

Change-Id: Ib0b3fe4afea9096ffa3a1347b4f7e07d3398b0b2
2017-05-05 12:03:54 +00:00
Brian Wolff
d4385537bc SECURITY: XSS in search if $wgAdvancedSearchHighlighting = true;
In the non-default configuration where $wgAdvancedSearchHighlighting
is set to true, there is an XSS vulnerability as HTML tags are
not properly escaped if the tag spans multiple search results

Issue introduced in abf726ea0 (MediaWiki 1.13 and above).

Bug: T144845
Change-Id: I2db7888d591b97f1a01bfd3b7567ce6f169874d3
2017-04-06 13:42:44 -07:00
Stanislav Malyshev
1e412aabdf Add deleted archive titles search
Allows search engine to suggest deleted titles for undelete search.
Note that the titles are still verified against the archive table,
to ensure search engine is not out-of-date.

Bug: T109561
Change-Id: Id6099fe9fbf18481068a6f0a329bbde0d218135f
2017-04-05 12:02:35 -07:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Stanislav Malyshev
cae86036aa Allow fields to define their own merge strategy via callback.
Change-Id: Ic1cc1581f07381224d3f4fcba4feb1eac7085057
2017-03-07 10:36:53 -08:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
jenkins-bot
0a2297c406 Merge "Fixes for more robust dealing with content handlers." 2017-01-30 16:06:25 +00:00
David Causse
cc61a14751 Allow SearchEngine users to access features data
Useful in case the client wants to re-evaluate what was set
here, or if the SearchEngine implementation wants to expose
some of its states.
In our case it allows CirrusSearch to inform SpecialSearch
that we prefer to display search results with a new experimental
layout.

Bug: T156299
Change-Id: I7f661c852ef70ea7bc9ae2959f7d6e48776a9877
2017-01-27 15:12:10 +01:00
Stanislav Malyshev
60ffe51c79 Fixes for more robust dealing with content handlers.
Change-Id: I12a02da005f4b2bceaa850bd1f41a90ac4e1754a
2017-01-26 12:20:07 -08:00
Bartosz Dziewoński
0cccd68dc8 Code style: no space after unary minus operator
Searched for /([^\d\w\s\)\]]\s*)- \d/ to find potential issues.
It seems there's no PHPCS check for this, huh.

Also fixed typo in a comment in LoginSignupSpecialPage.

Change-Id: Iaab1a1f5a9f234971e550e7909aa5c3e0c02a983
2017-01-05 14:38:32 +01:00
Max Semenik
d4f3e554d7 Decrease the number of 'function says it should return something' errors
Change-Id: Ib5115fe5bbaa67d8a6e54cc3ba1ba7020e239e11
2016-12-15 16:05:52 -08:00
Erik Bernhardson
41f9c933b3 Fix two instances of calling function with too few args
At one point SearchIndexFieldDefinition was updated to require the
engine to be passed in, but it seems that update was missed here.

BackupDumper::loadPlugin() requires the second argument, set it to
the empty string to keep current behaviour.

Change-Id: Ifbd8fc4870ff63b2d338f8bb4d251d7a3477b989
2016-12-15 13:24:40 -08:00
Thiemo Mättig
00c3f09566 Remove empty lines from PHP and JavaScript comment blocks
This is a pure documentation change. It mostly removes empty lines from
comments (and entirely empty comments), as well as adds a few missing
documentation blocks and fixes a minor mistake. I hope it's ok to have
this in one patch. I can split it, please tell me.

Change-Id: I9668338602ac77b903ab6b02ff56bd52743c37c4
2016-12-09 09:01:06 +00:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
It looks like there is something missing after the last statement
Also remove some other empty lines at begin of functions, ifs or loops
while at these files

Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
2016-11-05 11:55:10 +01:00
dcausse
bd7df68603 Do not run exact db match if offset is > 0
When scrolling results on prefix search api the exact Title
match is always at pos 0 even if we want to scroll the results
by setting offset to > 0.

Change-Id: Ib02c9d3e479d739e6fe79014d962db50b6fd9de8
2016-09-27 15:28:14 +02:00
dcausse
5417b6edc7 Add new type SearchIndexField::INDEX_TYPE_SHORT_TEXT
Useful for short technical strings such as mime types.

Change-Id: If440378f2b7004abed87eca4bbde767212c4b062
2016-09-26 12:50:23 +02:00
jenkins-bot
82dcfbe20e Merge "Pass User to SearchEngine::getProfiles" 2016-09-20 20:30:36 +00:00
dcausse
16e2491a73 Pass User to SearchEngine::getProfiles
Useful for search engines that allow users to customize search profiles.

Depends-On: Icd577c8ebc6e162befe30bde4fe276e633d2e434
Change-Id: I471cd090730d2a25cb70d622ec3bebbe9583118c
2016-09-20 20:22:23 +00:00
dcausse
8b890bbe1b Extract replacePrefixes into a static method
Useful for some search engines that have a keyword that wants
to reuse this logic without building a new SearchEngine object.

Change-Id: Iee5bfd1da70b8339a98555ba062bd33b21f0b761
2016-09-19 16:54:06 +02:00
Aaron Schulz
d2202b8414 Add SearchEngineFactory::getSearchEngineClass() instead of using the DB
Change-Id: I46207cafec737cb830adc2bdf1b501a0d138b40d
2016-09-15 21:31:35 -07:00
Stanislav Malyshev
7e18cfc3b5 Infrastructure for augmenting search results
Bug: T117493
Change-Id: Ia5413a7846cc961026a2dc3542b619493bc76a23
2016-09-15 15:44:03 -07:00
jenkins-bot
dc178bf8f6 Merge "Clarify that $terms get preg_quoted by caller in SearchHighlighter" 2016-09-07 14:18:43 +00:00