Search: Difference between revisions

From Freephile Wiki
interim draft on search extension
extracted CirrusSearch and Elasticsearch content into it's own page
Line 23: Line 23:


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.
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>


== General ==
== General ==

Revision as of 12:41, 30 January 2016