org.tigris.scarab.util.word
Class LuceneSearchIndex

java.lang.Object
  extended byorg.tigris.scarab.util.word.LuceneSearchIndex
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Initializable, SearchIndex

public class LuceneSearchIndex
extends java.lang.Object
implements SearchIndex, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Initializable

Support for searching/indexing text

Version:
$Id: LuceneSearchIndex.java 10257 2006-08-07 22:43:30Z jorgeuriarte $
Author:
John McNally

Nested Class Summary
 class LuceneSearchIndex.UpdateThread
           
 
Field Summary
 
Fields inherited from interface org.tigris.scarab.util.word.SearchIndex
ATTACHMENT_ID, ATTACHMENT_TYPE_ID, ATTRIBUTE_ID, EMPTY_LIST, INDEX_PATH, ISSUE_ID, PARSE_ERROR, TEXT, VALUE_ID
 
Constructor Summary
LuceneSearchIndex()
          Ctor.
 
Method Summary
 void addAttachmentQuery(java.lang.Integer[] ids, java.lang.String text)
          Specify search criteria for attachments
 void addQuery(java.lang.Integer[] ids, java.lang.String text)
          Specify search criteria.
 void clear()
          Prepares the instance for reuse.
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Avalon component lifecycle method
 void contextualize(org.apache.avalon.framework.context.Context context)
           
 void doCreateIndex()
           
 java.lang.Long[] getRelatedIssues()
          returns a list of related issue IDs sorted by relevance descending.
 java.lang.Long[] getRelatedIssues(boolean mergeResults)
          returns a list of related issue IDs sorted by relevance descending.
 void index(Attachment attachment)
          Store index information for an Attachment
 void index(AttributeValue attributeValue)
          Store index information for an AttributeValue
 void initialize()
          Avalon component lifecycle method Initializes the service by loading default class loaders and customized object factories.
 void updateIndex()
          update the index for all entities that currently exist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneSearchIndex

public LuceneSearchIndex()
                  throws java.io.IOException
Ctor. Sets up an index directory if one does not yet exist in the path specified by searchindex.path property in Scarab.properties.

Method Detail

addQuery

public void addQuery(java.lang.Integer[] ids,
                     java.lang.String text)
Description copied from interface: SearchIndex
Specify search criteria. This is incremental.

Specified by:
addQuery in interface SearchIndex

addAttachmentQuery

public void addAttachmentQuery(java.lang.Integer[] ids,
                               java.lang.String text)
Description copied from interface: SearchIndex
Specify search criteria for attachments

Specified by:
addAttachmentQuery in interface SearchIndex

getRelatedIssues

public java.lang.Long[] getRelatedIssues()
                                  throws java.lang.Exception
Description copied from interface: SearchIndex
returns a list of related issue IDs sorted by relevance descending. Should return an empty/length=0 array if search returns no results.

Specified by:
getRelatedIssues in interface SearchIndex
Throws:
java.lang.Exception

getRelatedIssues

public java.lang.Long[] getRelatedIssues(boolean mergeResults)
                                  throws java.lang.Exception
returns a list of related issue IDs sorted by relevance descending. Should return an empty/length=0 array if search returns no results. If mergeResults==true, internally merges results of partial queries, otherwise performs an implicit AND operation on partial queries.

Specified by:
getRelatedIssues in interface SearchIndex
Throws:
java.lang.Exception

index

public void index(AttributeValue attributeValue)
           throws java.lang.Exception
Store index information for an AttributeValue

Specified by:
index in interface SearchIndex
Throws:
java.lang.Exception

index

public void index(Attachment attachment)
           throws java.lang.Exception
Store index information for an Attachment

Specified by:
index in interface SearchIndex
Throws:
java.lang.Exception

updateIndex

public void updateIndex()
                 throws java.lang.Exception
update the index for all entities that currently exist

Specified by:
updateIndex in interface SearchIndex
Throws:
java.lang.Exception

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon component lifecycle method

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Throws:
org.apache.avalon.framework.context.ContextException
See Also:
Contextualizable

initialize

public void initialize()
                throws java.lang.Exception
Avalon component lifecycle method Initializes the service by loading default class loaders and customized object factories.

Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
InitializationException - if initialization fails.
java.lang.Exception

clear

public void clear()
Description copied from interface: SearchIndex
Prepares the instance for reuse.

Specified by:
clear in interface SearchIndex

doCreateIndex

public void doCreateIndex()
                   throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2000-2004 Tigris.org. All Rights Reserved.