This application is bundled with:
  • XWiki Enteprise
  • XWiki Enterprise Manager
  • XWiki Watch
Plugin contributed by Jens Krämer and the XWiki Development Team.
This plugin can be downloaded.

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

Where:

  • 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).
To use the plugin in your wiki, you'll need to write some Velocity code to integrate it where you want to use it, as shown below.

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
#end

Result

Nb found: 1

  • Web Home : 0.18571019
Version 5.3 last modified by VincentMassol on 03/06/2008 at 16:44

Comments 0

No comments for this document

Attachments 0

No attachments for this document

Creator: VincentMassol on 2007/03/09 17:17
This wiki is licensed under a Creative Commons license
1.4.1.10194