## helma.Search

    Object
       |
       +--helma.Search

This class provides functionality for creating a fulltext search index based on Apache Lucene.
Defined in Search.js
Author: Robert Gaggl

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Constructor Summary
`helma.Search()` Constructs a new instance of helma.Search.

Methods Summary
`helma.Search.Index` | `createIndex(<org.apache.lucene.store.Directory> dir, <org.apache.lucene.analysis.Analyzer> analyzer)` Creates a new Lucene index in the directory passed as argument, using an optional analyzer, and returns an instance of helma.Search.Index.
`org.apache.lucene.store.FSDirectory` | `getDirectory(<File|helma.File|java.io.File|String> dir, <Boolean> create)` Returns an instance of org.apache.lucene.store.FSDirectory.
`org.apache.lucene.store.RAMDirectory` | `getRAMDirectory(<File|helma.File|java.io.File|String> dir)` Returns a RAM directory object.
`<static> {org.apache.lucene.analysis.Analyzer}` | `getAnalyzer(<String> key)` Returns a new Analyzer instance depending on the key passed as argument.

Constructor Detail

### helma.Search

    helma.Search()

Constructs a new instance of helma.Search. This merely checks if the Apache Lucene library is in the application classpath.

Returns:

A newly created instance of this prototype.

Author: Robert Gaggl

Method Detail

### createIndex

    helma.Search.Index createIndex(<org.apache.lucene.store.Directory> dir, <org.apache.lucene.analysis.Analyzer> analyzer)

Creates a new Lucene index in the directory passed as argument, using an optional analyzer, and returns an instance of helma.Search.Index. Any already existing index in this directory will be preserved.

Parameters:

`dir` - The directory where the index should be stored. This can be either a FSDirectory or a RAMDirectory instance.

`analyzer` - The analyzer to use for the index. If not specified a StandardAnalyzer will be used.

Returns:

The index instance.

### getDirectory

    org.apache.lucene.store.FSDirectory getDirectory(<File|helma.File|java.io.File|String> dir, <Boolean> create)

Returns an instance of org.apache.lucene.store.FSDirectory. If no index is present in the given directory, it is created on the fly.

Parameters:

`dir` - The directory where the index is located or should be created at.

`create` - If true the index will be created, removing any existing index in the same directory

Returns:

The index directory.

### getRAMDirectory

    org.apache.lucene.store.RAMDirectory getRAMDirectory(<File|helma.File|java.io.File|String> dir)

Returns a RAM directory object.

Parameters:

`dir` - Optional directory containing a Lucene index from which this RAM directory should be created.

Returns:

A RAM directory instance.

### getAnalyzer

    <static> {org.apache.lucene.analysis.Analyzer} getAnalyzer(<String> key)

Returns a new Analyzer instance depending on the key passed as argument. Currently supported arguments are "br" (BrazilianAnalyzer), "cn" (ChineseAnalyzer), "cz" (CzechAnalyzer), "nl" (DutchAnalyzer), "fr" (FrenchAnalyzer), "de" (GermanAnalyzer), "el" (GreekAnalyzer), "keyword" (KeywordAnalyzer), "ru" (RussianAnalyzer), "simple" (SimpleAnalyzer), "snowball" (SnowballAnalyzer), "stop" (StopAnalyzer) "whitespace" (WhitespaceAnalyzer). If no argument is given, a StandardAnalyzer is returned.

Parameters:

`key` - The key identifying the analyzer

Returns:

A newly created Analyzer instance

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Documentation generated by JSDoc on Thu Apr 5 01:59:00 2007