Difference between revisions of "Search"

From Freephile Wiki
Jump to navigation Jump to search
(link to the Replace Text extension)
(interim draft on search extension)
Line 14: Line 14:
  
 
=== Native (Application) Search ===
 
=== Native (Application) Search ===
Applications such as this wiki (mediawiki), and CMS systems (e.g. Drupal) obviously know their own content.  So, if you are looking for something and want the best results for those applications, you should make use of the direct search facilities in the application.  Note that this wiki and the CMS systems also provide an 'OpenSearch' implementation that lets you use your browser's search toolbar to directly search these applications.
+
Applications such as this wiki (runs on MediaWiki), and CMS systems (e.g. Drupal) obviously know their own content.  So, if you are looking for something and want the best results for those applications, you should make use of the direct search facilities in the application.   
 +
# [[mw:Search]] helps you learn and understand the search capabilities of this system
 +
# Note that the simplest enhancement you can make to a small-scale installation is to tweak the MySQL stopwords and word-length.  However, the built-in search capability of MediaWiki is actually not that great.  See the section below on CirrusSearch
 +
 
 +
Note that this wiki and the CMS systems also provide an 'OpenSearch' implementation that lets you use your browser's search toolbar to directly search these applications.
  
 
The MediaWiki system now includes a Ajax 'suggest' feature while you type in the search box.  Setting is a UPO or User Preference Option that you control in your user settings.
 
The MediaWiki system now includes a Ajax 'suggest' feature while you type in the search box.  Setting is a UPO or User Preference Option that you control in your user settings.
  
If you're a sysop for a MediaWiki site, you probably want to install the [[wm:Extension:Replace_Text]] so that you can search and replace strings in your content.
+
If you're a sysop for a MediaWiki site, you probably want to install the [[mw:Extension:Replace_Text]] so that you can search and replace strings in your content.
 +
 
 +
==== Cirrus Search ====
 +
To really get good search experience with MediaWiki, you should install the [[mw:Extension:CirrusSearch]].  To do so, first install the [[ElasticSearch]] system (you can use [https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html the repositories for that]).  ElasticSearch is a Java application, so you need Java installed as well.
 +
 
 +
<source lang="bash">
 +
# is the curl extension to PHP installed?
 +
php -i |grep -C2 curl
 +
# no curl?
 +
sudo apt-get install php5-curl
 +
pushd extensions
 +
java -version
 +
# no java
 +
sudo apt-get install default-jre
 +
# need the jdk
 +
sudo apt-get install default-jdk
 +
# add JAVA_HOME to /etc/environment
 +
sudo update-alternatives --config java
 +
echo 'JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java' |sudo tee -a /etc/environment
 +
source /etc/environment
 +
echo $JAVA_HOME
 +
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
 +
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
 +
sudo apt-get update && sudo apt-get install elasticsearch
 +
echo PATH=$PATH:/usr/share/elasticsearch/bin/ | sudo tee -a /etc/environment
 +
source /etc/environment
 +
which elasticsearch
 +
sudo service elasticsearch start
 +
# check with curl (see below)
 +
# using SysV init
 +
sudo update-rc.d elasticsearch defaults 95 10
 +
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/CirrusSearch.git
 +
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Elastica.git
 +
cd Elastica
 +
composer install
 +
# load Special:Version to check
 +
</source>
 +
 
 +
Checking if elasticsearch is running
 +
<source lang="bash">
 +
curl -X GET http://localhost:9200/
 +
</source>
 +
<source lang="javascript">
 +
{
 +
  "name" : "Carmella Unuscione",
 +
  "cluster_name" : "elasticsearch",
 +
  "version" : {
 +
    "number" : "2.1.1",
 +
    "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
 +
    "build_timestamp" : "2015-12-15T13:05:55Z",
 +
    "build_snapshot" : false,
 +
    "lucene_version" : "5.3.1"
 +
  },
 +
  "tagline" : "You Know, for Search"
 +
}
 +
</source>
  
# [[mw:Search]] helps you learn and understand the search capabilities of this system
 
# The Lucene backend used on Wikipedia [[mw:Extension:Lucene-search]] can be used for large-scale installations where the built-in search is not sufficient.  Note that the simplest enhancement you can make to a small-scale installation is to tweak the MySQL stopwords and word-length.
 
  
 
== General ==
 
== General ==

Revision as of 19:55, 29 January 2016