Commit graph

155 commits

Author SHA1 Message Date
Brion Vibber
366b347795 Follow-up to r45425 -- bug was in MWSearch, not core. It's supposed to be HTML-formatted, but was being built unsafely.
Adding a comment on SearchEngine to clarify that getSuggestionSnippet() returns HTML
2009-01-05 20:46:43 +00:00
Robert Stojnić
584883b69e Backport r45215 to old search ui and move search engine creation before page setup so we can do the setup properly. 2008-12-31 04:48:23 +00:00
Robert Stojnić
4115586000 Pair to previous commit: handle the 'prefix' param - the default backend will just save it into variable and ignore it. 2008-12-31 03:33:08 +00:00
Brion Vibber
920eb84f1f * (bug 15027) Internet domain names and IP addresses can now be indexed and searched sensibly with the default MySQL search backend.
Previously things like "192.168.1.1" couldn't be searched very cleanly in the MySQL backend for two reasons:
* First, the periods were stripped out. This resulted in it being broken into multiple short words: "192 168 1 1", leading at best to false positives and general weirdness.
* Second, for IP addresses these were shorter than the default minimum word length of 4 and thus didn't even get indexed!

The addition of padding for short words let them at least get indexed, but they still didn't turn up cleanly due to the word split. Now allowing periods through to the indexed text, and encoding periods that appear within a compound word so they get caught more cleanly.

Also made a tweak so highlighting works a bit better on word boundaries -- eg "192.168.1.1" no longer hits a highlight match for "192.168.1.100". However it's still not 100% handling some cases with the periods. Sigh.
2008-12-19 01:50:07 +00:00
Brion Vibber
26486f91ee Revert r44257 "Use boolean searching with '?' char"
Let's avoid making up our own syntax that nobody will know or think to try...
Lucene, Google, Yahoo!, and Windows Live search all understand "red OR lion" but see nothing special in "?red ?lion". If we're going to add it, let's make the OR thing work. :)
2008-12-10 23:06:44 +00:00
Aaron Schulz
8452620711 Use boolean searching with '?' char 2008-12-05 18:16:01 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Alexandre Emsenhuber
d587615b29 API wants namespaces to be separated with a pipe, not a comma 2008-11-22 11:35:01 +00:00
Aaron Schulz
915af4890f * Re-commit new search UI code, disabled by default. Old form messages still used and thus kept.
* Update old-fashioned profile calls
2008-11-17 04:56:14 +00:00
Brion Vibber
c94046752b Reverting in-development search changes pending fixing.
Can we please do these sorts of experimental developments on branches before putting them to trunk? Our trunk is meant to be functional and ready to deploy at all times; doing experiments on trunk delays deployments because we have to test and fix them or roll them back.

Reverted:
r43376
r43385
r43403
r43404
r43405
r43406
r43423

Issues I noticed during a few minutes testing:
* Background color mismatch on the frameset for wikis that set a BG color on Special:
* 'browse pages with this prefix' is kind of funky in "Pages & Project" (goes to main namespace only)
* Which namespaces are in "Pages & Project" is not discoverable
* Default link to nonexistent help page Project:Searching kind of sucks. we should avoid doing those by default. It used to link to Help:Contents; any reason for the change from one page which might have previously existed to one which doesn't?
* "Create the page "Stuff" on this wiki!" - Double page creation links seem kind of weird. There should only be one, otherwise why have two?
* Bad prefix link output when search terms are not a valid wiki title
* We've lost the Whatlinkshere link from the old results
2008-11-14 19:11:52 +00:00
Aaron Schulz
3c36b94027 * Recommitting Search UI changes from r42352
** User search preference removed
** Added Project search
** Removed 'all' prefix use
** Keep help/page link in same fieldset
** Fixed title case of direct page/create link
** Moved "Files" link next to 'page'
** Made 'advanced' act more consistent
* Added div to make next/prev links clearer
* Reduced the 'next' Links to Nowhere
* Removed misaligned bullets
* Code cleanup/better function names/mark visibility
2008-11-11 00:03:43 +00:00
Robert Stojnić
3f183eafd5 Recommit part of r42352 related to bug 5101 (Image from Commons doesn't show up when searched in Wikipedia search box) 2008-11-04 22:19:37 +00:00
Brion Vibber
5c70d85ca9 Back out r42352, r42355, r42363, r42410 for now "Redesigning Special:Search"
It's still very awkward, with weird error messages, some styling issues, and generally needs a lot of polish. Not ready to go live.
2008-10-25 00:25:51 +00:00
Robert Stojnić
f58d22d153 Redesign Special:Search:
* remove all horrible long messages that just kept being sticked on the search page. There is
  no reason to show long messages on *every search* to *everyone*, use the Help link instead
* organize search options into a straighforward menu on right side of search box
* Search box now comes with a header for quickly switching between typical namespace groups:
  - Articles - wgNamespacesToBeSearchedDefault namespaces, default for anons
  - Articles/Project - wgNamespacesToBeSearchedDefault + wgNamespacesToBeSearchedProject, 
    default for logged-in users. Contains namespaces like main, user, project, etc.. 
  - Images - local/commons images
  - Everything - quick link to search *all* namespaces
  - Advanced - this will show our powerbox, which is now not shown on every page

Preferences change:
* logged-in users by default search more namespaces than anons, this relies on assumption
  that logged in users are more likely to be regular contributors in a community, and 
  thus be interested in community stuff as well as articles

* bug 14609, if users leave their namespaces settings on default, changing default 
  search namespaces will change users namespaces as well

Images:
* bug 5101. Don't hide commons images as broken links if search backend is smart enough to
  return them.
2008-10-22 23:08:07 +00:00
Tim Starling
a66784ec98 Don't double-escape search terms before highlighting. It's done once already SearchResultSet::termMatches(). Doing it twice results in / -> \/ -> \\/, literal backslash followed by end of regex. Not obvious in SearchMySQL because of stripForSearch(), but visible in MWSearch.
The fact that it's done in termMatches() already is hackish and undocumented, but I won't change it right now.
2008-09-20 06:18:43 +00:00
Chad Horohoe
f7ccf99e1f Tweak comment: fixed it but didn't remove the fixme. 2008-08-19 03:48:26 +00:00
Chad Horohoe
e8ad8d066d Remove DB logic from SearchEngine. New method in Database and associated subclasses called getSearchEngine() does this now. 2008-08-18 15:22:00 +00:00
Brion Vibber
b0c477aa1d * (bug 14966) Fix SearchEngineDummy class for silently non-functional search
on Sqlite instead of horribly fatal error breaky one.
2008-07-28 23:42:30 +00:00
Chad Horohoe
aaf794947a Remove a bit of useless $wgCapitalLinks logic, all these code paths lead through Title::secureAndSpit() which handles initial-character-capitalization.
*In SearchEngine's case, it gets caught every time further up the page (it never even reaches the upper/lower casing of only first character part)
*PrefixSearch eventually sends it through ApiQueryBase::titleToKey()
*AjaxFunctions immediately sends it to Title::newFromText()
2008-07-25 23:12:27 +00:00
Brion Vibber
3afabc850d Revert r36413 -- renaming of search files into 'search' subdirectory
The loss of specific names would create a visible name conflict; when you've got "MySQL.php" open, what the hell is it? Is it the DatabaseMySQL class? Some other random MySQL-related thing? Update.php is also confusing -- we have an update.php which is a command-line script.
Don't do these confusing names; there's no pressing functional need to move the files at all, but if you must move them at least keep their distinct names so I can find my code.
2008-06-19 21:02:23 +00:00
Bryan Tong Minh
f0a89957f8 Recommit r36403 with working version history hopefully: Move Search*.php to search/*.php 2008-06-18 09:01:41 +00:00
Bryan Tong Minh
de73a13544 Revert r36403: Breaking SVN version history 2008-06-18 08:41:05 +00:00
Chad Horohoe
61b77c1b0b More ~/includes cleanup. Moving all the Search*.php files to ~/includes/search. 2008-06-17 20:58:32 +00:00
Robert Stojnić
6ca27fc95f (bug 13034) can again use Go button to go to interwiki pages.
Couldn't figure out what broke it in the first place however
2008-05-29 20:48:57 +00:00
Brion Vibber
d39ba4d673 Safety first... none of these *should* fail in an ideal world, but they in fact sometimes do. So.... :D 2008-05-29 18:15:05 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Robert Stojnić
abf726ea02 Re-commit r34072 with some modifications:
* turned off by default (set $wgAdvancedSearchHighlighting to turn on)
* reverted r26269, \b doesn't interact very good with unicode data,
  so it broke highlighting of words that end/begin in nonascii chars
  completely
* small bugfixes in unicode handling, tested in more languages
* $wgSearchHighlightBoundaries need to be set to "" for CJK wikis
* benchmarking: on typical simplewiki data, the code is around 4-5 slower
  (according to noc.wikimedia.org the old code profiles to about 0.8%),
  but can be up to 20 times slower on featured-size articles
* update release notes (also for r33400)
* fix profiling errors in SpecialSearch
2008-05-04 15:31:03 +00:00
Brion Vibber
723fe778bc Revert for now:
* r34072 -- new highlighter code; looks a bit expensive, not fully tested yet.
* r33489 -- broke search result highlighting all around
* Part of r32350 -- bring the color back to search highlighting so we can see our results again. Why was this removed without comment?
2008-05-01 20:55:03 +00:00
Robert Stojnić
54dfb7b2ca New class SearchHighlighter handles highlighting of search terms and
snippet extraction:
* prefer text hits over matches on images/templates/tables, making the 
  snippets more readable and relevant
* cleanup wikitext
* prefer snippets with exact query match - works only for whole phrases
* drop the old context calculation and replace it will a more flexible one
  that does a better job keeping snippets of constant width
* if the first line of the article matches whole query show only one snippet
* manually lower/uppercase non-ascii chars so that words in e.g. cyrillic 
  are also case-insensitive
* workaround for php limited utf8 support so that snippets end up being of
  constant char-size over single and multiple byte text
* if there is no text match for some reason, show beginning of the article
Warning:
* haven't done performance testing, might not be safe to go live, although 
  I don't see any immediate problems with it
2008-05-01 13:36:29 +00:00
River Tarnell
d426f7c5c0 Notice: Undefined property: PostgresSearchResult::$mRevision in /data/home/river/www/wiki/includes/SearchEngine.php on line 518 2008-04-30 09:49:58 +00:00
Aryeh Gregor
675f1701c9 The problem also applies to all the other regex special chars: try it out with ., |, etc. Use preg_quote(). 2008-04-17 15:59:49 +00:00
Greg Sabino Mullane
377f79b5b8 Escape forward slashes in search terms, otherwise PHP thinks the regex has ended and starts treating the rest of the characters in the string as PCRE modifiers. 2008-04-17 15:38:26 +00:00
Robert Stojnić
724def7bef Use content language for search prefixes. 2008-04-17 15:11:42 +00:00
Robert Stojnić
d6fd8e7c13 Ajax suggestions:
* check in a new ajax suggestion engine (mwsuggest.js) which uses 
  OpenSearch to fetch results (by default via API), this should
  deprecated the old ajaxsearch thingy
* extend PrefixSearchBackend hook to accept multiple namespaces for
  future lucene use (default implementation however can still 
  process only one)
* Added to preferences, also a feature to turn it on/off for every 
  input (disabled atm until I work out browser issues completely)
* WMF wikis probably won't be using API to fetch results, but a 
  custom php wrapper that just forwards the request to appropriate
  lucene daemon, added support for that

SpecialSearch:
* moved stuff out of SpecialSearch to SearchEngine, like snippet
  highlighting and such
* support for additional interwiki results, e.g. title matches
  from other projects shown in a separate box on the right
* todo: interwiki box doesn't have standard prev/next links to 
  avoid clutter and unintuitive interface
* support for related articles
2008-04-15 23:06:28 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Robert Stojnić
7532064d27 Search backend:
* add "all:" prefix that searches all namespaces (port from LuceneSearch)
* added a simplistic replacePrefixes so that now image:something will
  always search the image namespace
2008-03-23 17:29:43 +00:00
Robert Stojnić
82d7b2216b Search frontend:
* let the backend provide snippets and other info, fill only what is not 
  provided
* wrap textual results in a div, should make the snippets look more 
  compact and consistent over hits
* added a did you mean.. container
* show total number of hits if available
* added messages for "redirects to article", and "relevant section" hits
2008-03-23 13:43:11 +00:00
Brion Vibber
850cc98cf0 * (bug 11563) Deprecated SearchMySQL4 class; merged code to SearchMySQL
Some general cleanup on search backend code style :)
2008-03-18 23:50:05 +00:00
Greg Sabino Mullane
c07e337da6 Fix for bug 13004, in which the Postgres full-text search has too many results,
so it throws an error. Created a "too many" class as an alternate search result 
to return, and consider any error in SearchPostgres when running the actual search as a "too many" 
problem. Not an ideal solution, but I'm not sure how to get at the error message 
without requiring a newer version of PHP.
2008-02-17 14:11:55 +00:00
Brion Vibber
6e63f4cbad Add SearchGetNearMatch hook, have TitleKey provide a case-insensitive exact match for "go" searches. 2008-01-31 20:51:42 +00:00
Huji
2d8a62941c (bug 12608) Unifying the spelling of getDBkey() in the code. 2008-01-14 09:13:04 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Brion Vibber
b08f93c1db Add a free() function on SearchResultSet class, so the underlying result set can be freed 2007-06-06 18:36:11 +00:00
Tim Starling
ed4303922f Merged filerepo-work branch:
* Added support for configuration of an arbitrary number of commons-style file repositories.
* Split Image.php into filerepo/File.php and filerepo/LocalFile.php
* Renamed Image::getImagePath() to File::getPath()
* Added initial support for timestamp-based file fetching (OldLocalFile), to be expanded upon by aaron.
* Changed the interface for Image/File object creation: use wfFindFile() or wfLocalFile() depending on semantics
* ImageGallery::add() now accepts a title object as the first parameter
* Moved file handling operations on upload from SpecialUpload to File
* Removed path-related functions from ImageFunctions.php. Removed static path accessors from File. 
* Added a Content-Disposition header to thumb.php output
* Improved thumb.php error handling
* Updated the unit test suite to kind of partially work with modern computers. RunTests.php doesn't work just yet. Fixed an actual regression that the test suite detected -- moved some defines to Defines.php where they will be loaded consistently.
2007-05-30 21:02:32 +00:00
Brion Vibber
9b06c5355c E_STRICT fixlets: more static method markers
Also fixed a public function which was listed as private in comments for some reason
2007-05-02 16:02:23 +00:00
Antoine Musso
343420d0ad Convert whitespaces to tabulations 2007-04-21 14:44:56 +00:00
Brion Vibber
44c6db416f * (bug 5439) "Go" title search will now jump to shared/foreign Image: and
MediaWiki: pages that have not been locally edited.
2007-04-20 15:22:41 +00:00
Nick Jenkins
f9619da3f0 Yet more doc tweaks:
* Add @addtogroup tags to various classes, to try and group conceptually-related classes together.
* Add brief descriptions to various Special pages, thanks to Phil Boswell.
* Moving some docs to be right above the classes they represent, so that they are picked up.
2007-04-20 08:55:14 +00:00
River Tarnell
0b2f7f7ea4 full-search search for oracle using Oracle Text 2007-03-11 04:41:02 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00