Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Global search (GSoC2013): Difference between revisions

From MoodleDocs
No edit summary
Line 63: Line 63:
Next, you will be ready to install the PECL extension for Solr by cloning the following repository for Solr 4.x. (Please Note: Current;y, the official <code>php-pecl-solr</code> is not compatible with <code>Solr 4.x</code>. The following repository provides a small fix to make it compatible with <code>Solr 4.x</code> and will go to the official release.)
Next, you will be ready to install the PECL extension for Solr by cloning the following repository for Solr 4.x. (Please Note: Current;y, the official <code>php-pecl-solr</code> is not compatible with <code>Solr 4.x</code>. The following repository provides a small fix to make it compatible with <code>Solr 4.x</code> and will go to the official release.)


1. git clone https://github.com/lukaszkujawa/php-pecl-solr.git
*<code>git clone https://github.com/lukaszkujawa/php-pecl-solr.git</code>
2. cd php-pecl-solr/
*<code>cd php-pecl-solr/</code>
*<code>phpize</code>
**This a shell script used to prepare the build environment for a php extension to be compiled.
If the <code>libxml2</code> and <code>libcurl</code> libraries were compiled from source, then you will have to pass the <code>libcurl</code> prefix to the configure script for <code>CURL</code> and <code>LIBXML</code> respectively as shown below:


If the above two dependencies were already installed, execute:
*<code>sudo ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software</code>
3. sudo ./configure  
*If you already have the latest versions of the libraries then executing <code>sudo ./configure</code> is sufficient.
 
*sudo make
4. sudo make
*sudo make install
5. sudo make install


The above procedure will compile and install it in the <code>extension_dir</code> directory in the <code>php.ini</code> file. To enable, the installed extension, you could follow any of the following two steps:
The above procedure will compile and install it in the <code>extension_dir</code> directory in the <code>php.ini</code> file. To enable, the installed extension, you could follow any of the following two steps:
Line 86: Line 88:
You can now view the '''solr''' extension by executing <code>echo phpinfo();</code> in browser or <code>php -m</code> in Terminal (<code>Ctrl+Alt+T</code>)  
You can now view the '''solr''' extension by executing <code>echo phpinfo();</code> in browser or <code>php -m</code> in Terminal (<code>Ctrl+Alt+T</code>)  
    
    
After installing the php-pecl-solr extension, users will have to download [http://lucene.apache.org/solr/mirrors-solr-latest-redir.html? Apache Solr]  and keep it in an external directory.
After installing the php-pecl-solr extension, users will have to download [http://lucene.apache.org/solr/mirrors-solr-latest-redir.html? Apache Solr]  and keep it in an external directory.


== Schedule ==
== Schedule ==

Revision as of 02:05, 9 June 2013

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.

Global search
Project state Community bonding period
Tracker issue MDL-31989
Discussion Writing Moodle's Global Search
Assignee Prateek Sachan

GSOC '13

Introduction

Global Search will have the feature of searching keywords within the entire Moodle site across modules keeping the security intact.

  • It will display results based on relevance weightage.
  • Security will be preserved throughout the search.
  • Search Modules will enable chosen search engine integration with ease. Admins will have the option for selecting the modules that could be made "searchable"
  • It will include keywords from other files types (like PDFs, PPTs, HTML content and others).
  • Following are the features that I'm considering in implementing in the first version of Global Search:
  1. Groupings of AND and OR. Eg.: ("query1" AND "query2") OR "query3"
  2. Searching for phrases. Results with matched phrase will have higher priority and hence will be shown higher in the results.
  3. Wildcard (*) (?) feature.
  4. Stemming. Eg.: bag will return results both from bag and bags


Installation

For using Global Search, users will have to install the PHP Solr PECL extension on server.

Following is the procedure for installing the extension in UNIX:

There are two dependencies of the extension:

  • CURL extension (libcurl 7.15.0 or later is required)
  • LIBXML extension (libxml2 2.6.26 or later is required)

Test whether the required extensions are installed or not by executing the following in a php file (Remember to delete the file as it has important information about your system):

echo phpinfo();

If the system does not have required versions of libcurl or libxml libraries, follow the steps given below. You will have to download the libraries

and compile them from source into a separate install prefix.

  1. For libcurl:
    wget http://curl.haxx.se/download/curl-7.19.6.tar.gz

tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 sudo ./configure --prefix=/root/custom/software sudo make sudo make install

  1. For libxml:
    wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz

tar -zxvf libxml2-2.7.6.tar.gz cd libxml2-2.7.6 sudo ./configure --prefix=/root/custom/software sudo make sudo make install After installing the above dependencies, you will need to restart your apache server by executing sudo service apache2 restart

Next, you will be ready to install the PECL extension for Solr by cloning the following repository for Solr 4.x. (Please Note: Current;y, the official php-pecl-solr is not compatible with Solr 4.x. The following repository provides a small fix to make it compatible with Solr 4.x and will go to the official release.)

If the libxml2 and libcurl libraries were compiled from source, then you will have to pass the libcurl prefix to the configure script for CURL and LIBXML respectively as shown below:

  • sudo ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software
  • If you already have the latest versions of the libraries then executing sudo ./configure is sufficient.
  • sudo make
  • sudo make install

The above procedure will compile and install it in the extension_dir directory in the php.ini file. To enable, the installed extension, you could follow any of the following two steps:

1. Navigate to the directory etc/php5/conf.d and create a new solr.ini file with the following line:

extension=solr.so

OR

2. Open your php.ini file and include the following line:

extension=solr.so

You may follow any of the above two steps. You will need to restart your apache server after that by executing sudo service apache2 restart

You can now view the solr extension by executing echo phpinfo(); in browser or php -m in Terminal (Ctrl+Alt+T)

After installing the php-pecl-solr extension, users will have to download Apache Solr and keep it in an external directory.

Schedule

Design

See also