Lucene Plugin
A plugin that indexes a wiki's documents using Lucene, in an asynchronous manner. It can be used in place of the default search implementation which uses Hibernate to search for documents.Installation
Activate the plugin by editing your WEB-INF/xwiki.cfg file as follows and restart your XWiki instance:xwiki.plugins=[...],com.xpn.xwiki.plugin.lucene.LucenePlugin xwiki.plugins.lucene.indexdir=/tmp/xwiki/lucene xwiki.plugins.lucene.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer xwiki.plugins.lucene.indexinterval=20
- The indexdir property points to where Lucene will generate the index file.
- The analyzer property is the default Lucene Analyzer which converts all words in lowercase and filters out simple words such as "the", "a", etc. You can specify any Analyzer you wish to use here.
- The indexinterval property controls how frequently the plugin starts an indexation thread (the value is in seconds).
Example
Here's some code that does a search on "keyword" and lists all the results found:#set($results = $xwiki.lucene.getSearchResults("keyword", "default,en,fr"))
Nb found: $results.hitcount
#foreach($result in $results.results)
* [${result.web}.${result.name}] #if($result.filename)($result.filename)\#end : $result.score
#endResult
Nb found: 1- Web Home : 0.18571019
Version 5.3 last modified by VincentMassol on 03/06/2008 at 16:44
Document data
Attachments:
No attachments for this document
Comments: 0