okapi.util
Class OkapiSearchUtils.Searcher

java.lang.Object
  extended by okapi.util.OkapiSearchUtils.Searcher
Enclosing class:
OkapiSearchUtils

public static class OkapiSearchUtils.Searcher
extends java.lang.Object

class Searcher Class to perform searching and incremental index updates. To perform a search: - set the index directory with OkapiSearchUtils.setIndexPathsFromContext() or OkapiSearchUtils.setIndexPaths() - get a Searcher with OkapiSearchUtils.getSearcher() - call doSearch() - release the Searcher with OkapiSearchUtils.releaseSearcher() To update the index: - set the index directory with OkapiSearchUtils.setIndexPathsFromContext() or OkapiSearchUtils.setIndexPaths() - get a Searcher with OkapiSearchUtils.getSearcher() - call doUpdate() - release the Searcher with OkapiSearchUtils.releaseSearcher() Note that the Searcher always needs to be released after use.


Method Summary
 java.util.Vector doSearch(java.lang.String searchText, java.lang.String nexusPath, java.lang.String urlRoot)
          doSearch Performs a search for the specified search terms in the specified nexus.
 java.util.Vector doShowIndex(java.lang.String urlRoot)
          doShowIndex Returns everything in the index (in every nexus).
 java.util.Vector doShowNexus(java.lang.String nexusPath, java.lang.String urlRoot)
          doShowNexus Performs a search for all documents in the specified nexus.
 boolean doUpdate(OkapiArc arc, java.lang.String nexusPath, java.lang.String arcPath, boolean delete)
          doUpdate -- NOT TESTED Adds, updates, or deletes the arc's index entry in the current working index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doSearch

public java.util.Vector doSearch(java.lang.String searchText,
                                 java.lang.String nexusPath,
                                 java.lang.String urlRoot)
                          throws java.lang.Exception
doSearch Performs a search for the specified search terms in the specified nexus. The index directory should be set before calling this method.

Parameters:
searchText - search term(s)
nexusPath - path of current nexus (must be matched during search)
urlRoot - root of URL - arc path is appended to this to form the href
Returns:
vector containing search results (objects of type SearchResult)
Throws:
java.lang.Exception

doShowNexus

public java.util.Vector doShowNexus(java.lang.String nexusPath,
                                    java.lang.String urlRoot)
                             throws java.lang.Exception
doShowNexus Performs a search for all documents in the specified nexus. The index directory should be set before calling this method.

Parameters:
nexusPath - path of current nexus (must be matched during search)
urlRoot - root of URL - arc path is appended to this to form the href
Returns:
vector containing search results (objects of type SearchResult)
Throws:
java.lang.Exception

doShowIndex

public java.util.Vector doShowIndex(java.lang.String urlRoot)
                             throws java.lang.Exception
doShowIndex Returns everything in the index (in every nexus). The index directory should be set before calling this method.

Parameters:
urlRoot - root of URL - nexus and arc path are appended to this to form the href
Returns:
vector containing search results (objects of type SearchResult)
Throws:
java.lang.Exception

doUpdate

public boolean doUpdate(OkapiArc arc,
                        java.lang.String nexusPath,
                        java.lang.String arcPath,
                        boolean delete)
doUpdate -- NOT TESTED Adds, updates, or deletes the arc's index entry in the current working index. Before calling this method, set the index directory with OkapiSearchUtils.setIndexPathsFromContext() or OkapiSearchUtils.setIndexPaths().

Parameters:
arc - Arc to delete or re-index.
nexusPath - Cumulative path to the arc's nexus (i.e. "", "/OKI", "/OKI/searchdev").
arcPath - Cumulative path to the arc (i.e. "/courseMaterial/topics/topic2").
delete - If true, arc is deleted from index but not reindexed.
Returns:
true if successful, false otherwise


Copyright ? 2001-2009 MIT. All Rights Reserved.