inc/special/search.php
Used by the search action.
You can either use the default search engine, write your own template or use the old search.
Default search engine
The default search engine uses the swRelationSearch function.
This is a fulltext search on the name and the paragraphs of the articles.
More relevant articles are shown first.
The search uses the filter pattern of relation:
- words are found in the relaxed urltext mode
- multiple words can be combined with space (AND)
- multiple terms can be combined with the pipe character (OR)
Your own template
Define the name of your template in the configuration as $swCustomSearch. Note that it must be in the template namespace.
Your can use the relation function or whatever you find useful. A sample code (close to the default search engine) is Template:CustomSearch
The following parameters are transmitted to the template (use double curly to insert them in your code)
- query
- start
- previous link
- next link
The paging is 500. If you want another paging, make your own previous and next links.
Provide wikitext. The output will be parses
Old search (depreciated)
Set $swOldSearch = false in configuration.
Content search uses swFilter(). If there ar multiple words, it searches then for the longer words and then only inside the results.
if you enable $swQuickSearchRedirect, then the seach is redirected to page with literally the same name as the query.
The request $moreresults=1 searches again. On bigger sites, you might have to search several times to get all results.
Contents searches are ordered by relevance. Pages having the search term more often and sooner in the content are more relevant
By default, the results are presented in a search engine style with title and the portion of text found. But you can provide a swInternalSearchHook() function in configuration.php to reorder and style the search at your wish.