net.sf.mmapps.modules.lucenesearch
Class IndexHelper

java.lang.Object
  extended bynet.sf.mmapps.modules.lucenesearch.IndexHelper
Direct Known Subclasses:
SearchIndex

public class IndexHelper
extends java.lang.Object

This object handles access to Lucene indexes

Version:
$Revision: 1.1 $
Author:
Wouter Heijke

Constructor Summary
IndexHelper()
          Constructor for the IndexHelper object
 
Method Summary
 void close()
          Close the writer
 void create(java.lang.String name, org.apache.lucene.analysis.Analyzer analyzer)
          Create the index (writer)
 int delete(org.apache.lucene.index.Term term)
          Delete a document from the index
protected  void finalize()
           
 java.lang.String getIndexName()
          Returns the name of the index
 org.apache.lucene.search.IndexSearcher getSearcher()
          Returns the IndexSearcher for this index
 void open()
          Open the writer
 void setAnalyzer(org.apache.lucene.analysis.Analyzer a)
          Sets the analyzer attribute of the IndexHelper object
 void setIndexName(java.lang.String name)
          Sets the indexName attribute of the IndexHelper object
 int size()
          Return the amount of documents in the index when writing to it.
 void write(org.apache.lucene.document.Document document)
          Write a Lucene Document to the index
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexHelper

public IndexHelper()
Constructor for the IndexHelper object

Method Detail

setAnalyzer

public void setAnalyzer(org.apache.lucene.analysis.Analyzer a)
Sets the analyzer attribute of the IndexHelper object

Parameters:
a - The new analyzer value

setIndexName

public void setIndexName(java.lang.String name)
Sets the indexName attribute of the IndexHelper object

Parameters:
name - The new indexName value

getIndexName

public java.lang.String getIndexName()
Returns the name of the index

Returns:
Returns the indexName.

create

public void create(java.lang.String name,
                   org.apache.lucene.analysis.Analyzer analyzer)
Create the index (writer)

Parameters:
name -
analyzer -

open

public void open()
Open the writer


close

public void close()
Close the writer


write

public void write(org.apache.lucene.document.Document document)
Write a Lucene Document to the index

Parameters:
document - Lucene Document

size

public int size()
Return the amount of documents in the index when writing to it.

Returns:
-1 if no size or the amount of documents in the index

getSearcher

public org.apache.lucene.search.IndexSearcher getSearcher()
Returns the IndexSearcher for this index

Returns:
IndexSearcher

delete

public int delete(org.apache.lucene.index.Term term)
Delete a document from the index

Parameters:
term - A Lucene Term describing the document to delete
Returns:
Amount of deleted documents

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable


Copyright © 2003-2005 mmapps. All Rights Reserved.