uk.ac.kcl.cch.jb.pliny.lucene
Class NoteTextIndex

java.lang.Object
  extended byuk.ac.kcl.cch.jb.pliny.lucene.NoteTextIndex

public class NoteTextIndex
extends Object

This is a singleton class that manages the interface between Lucene and Pliny to support word searching in Pliny notes.

Author:
John Bradley
See Also:
NoteLucened, NoteSearchView

Method Summary
 void addNoteToIndex(NoteLucened myNote)
          adds information about a new NoteLucened to the Lucene index.
 void buildIndex(org.eclipse.core.runtime.IProgressMonitor monitor)
          builds the Lucene index, and provides support for the display of a progress monitor to the user.
static NoteTextIndex getInstance()
          returns the singleton instance of this class.
 boolean isIndexOn()
          returns true of the index has been set up.
 void removeNoteFromIndex(NoteLucened myNote)
          removes information about a new NoteLucened from the Lucene index.
 Vector search(String queryString)
          passes the query string to Lucene, takes results, and locates selected NoteLuucened which are then assembled into a Vector and returned.
 void updateNoteInIndex(NoteLucened myNote)
          updates the name or content of a NoteLucened in the Lucene index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NoteTextIndex getInstance()
returns the singleton instance of this class.

Returns:
the instance of NoteTextIndex

isIndexOn

public boolean isIndexOn()
returns true of the index has been set up.

Returns:
true if index has been set up.

buildIndex

public void buildIndex(org.eclipse.core.runtime.IProgressMonitor monitor)
                throws IOException
builds the Lucene index, and provides support for the display of a progress monitor to the user.

Parameters:
monitor - the monitor to be displayed to the user while s/he waits.
Throws:
IOException

addNoteToIndex

public void addNoteToIndex(NoteLucened myNote)
adds information about a new NoteLucened to the Lucene index.

Parameters:
myNote - the new note to be added.

removeNoteFromIndex

public void removeNoteFromIndex(NoteLucened myNote)
removes information about a new NoteLucened from the Lucene index. Used when the note is being removed from the system.

Parameters:
myNote - the new note to be removed from the Lucene index.

updateNoteInIndex

public void updateNoteInIndex(NoteLucened myNote)
updates the name or content of a NoteLucened in the Lucene index. Used when the user has changed the note's content.

Parameters:
myNote - note with name of content that has changed

search

public Vector search(String queryString)
              throws org.apache.lucene.queryParser.ParseException
passes the query string to Lucene, takes results, and locates selected NoteLuucened which are then assembled into a Vector and returned.

Parameters:
queryString - the Lucene query string.
Returns:
Vector containing NoteLucene items that Lucene selected.
Throws:
org.apache.lucene.queryParser.ParseException