net.ontopia.infoset.fulltext.impl.lucene
Class LuceneSearcher

java.lang.Object
  extended by net.ontopia.infoset.fulltext.impl.lucene.LuceneSearcher
All Implemented Interfaces:
SearcherIF

public class LuceneSearcher
extends java.lang.Object
implements SearcherIF

INTERNAL: The Lucene search engine implementation. This searcher searches documents using the Lucene search engine.


Field Summary
protected  org.apache.lucene.analysis.Analyzer analyzer
           
protected  java.lang.String default_field
           
protected  java.lang.String path
           
protected  org.apache.lucene.search.Searcher searcher
           
 
Constructor Summary
LuceneSearcher(org.apache.lucene.store.Directory dir)
          INTERNAL: Creates a searcher that will search a lucene index stored in the given lucene directory.
LuceneSearcher(org.apache.lucene.store.Directory dir, org.apache.lucene.analysis.Analyzer analyzer)
          INTERNAL: Creates a searcher that will search a lucene index stored in the given lucene directory.
LuceneSearcher(java.lang.String path)
          INTERNAL: Creates a searcher that will search a lucene index stored at the given file system path location.
LuceneSearcher(java.lang.String path, org.apache.lucene.analysis.Analyzer analyzer)
          INTERNAL: Creates a searcher that will search a lucene index stored at the given path location.
 
Method Summary
 void close()
          INTERNAL: Releases resources associated with this searcher.
 java.lang.String getDefaultField()
          INTERNAL: Returns the default field that lucene uses when searching.
 java.lang.String getPath()
          INTERNAL: Returns the file system path where the index used is stored.
static void main(java.lang.String[] argv)
          INTERNAL: Command line version of the searcher.
 SearchResultIF search(java.lang.String query)
          INTERNAL: Performs a query on an index.
 void setDefaultField(java.lang.String default_field)
          INTERNAL: Sets the default field that lucene is to use when searching.
protected static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

protected java.lang.String path

analyzer

protected org.apache.lucene.analysis.Analyzer analyzer

searcher

protected org.apache.lucene.search.Searcher searcher

default_field

protected java.lang.String default_field
Constructor Detail

LuceneSearcher

public LuceneSearcher(java.lang.String path)
               throws java.io.IOException
INTERNAL: Creates a searcher that will search a lucene index stored at the given file system path location. Tokenization will be done using the StandardAnalyzer.

Parameters:
path - The file system directory in which the index is located.
Throws:
java.io.IOException

LuceneSearcher

public LuceneSearcher(java.lang.String path,
                      org.apache.lucene.analysis.Analyzer analyzer)
               throws java.io.IOException
INTERNAL: Creates a searcher that will search a lucene index stored at the given path location. Tokenization will be done using the specified analyzer.

Parameters:
path - The file system directory in which the index is located.
analyzer - The token stream analyzer that the searcer is to use.
Throws:
java.io.IOException

LuceneSearcher

public LuceneSearcher(org.apache.lucene.store.Directory dir)
               throws java.io.IOException
INTERNAL: Creates a searcher that will search a lucene index stored in the given lucene directory. Tokenization will be done using the default analyzer.

Parameters:
dir - The lucene directory where the index is located.
Throws:
java.io.IOException
Since:
3.0

LuceneSearcher

public LuceneSearcher(org.apache.lucene.store.Directory dir,
                      org.apache.lucene.analysis.Analyzer analyzer)
               throws java.io.IOException
INTERNAL: Creates a searcher that will search a lucene index stored in the given lucene directory. Tokenization will be done using the specified analyzer.

Parameters:
dir - The lucene directory where the index is located.
analyzer - The token stream analyzer that the searcer is to use.
Throws:
java.io.IOException
Method Detail

getPath

public java.lang.String getPath()
INTERNAL: Returns the file system path where the index used is stored. null is returned if the index is not stored in a file system path.


getDefaultField

public java.lang.String getDefaultField()
INTERNAL: Returns the default field that lucene uses when searching.


setDefaultField

public void setDefaultField(java.lang.String default_field)
INTERNAL: Sets the default field that lucene is to use when searching.


search

public SearchResultIF search(java.lang.String query)
                      throws java.io.IOException
Description copied from interface: SearcherIF
INTERNAL: Performs a query on an index. The actual query syntax is search engine dependent.

Specified by:
search in interface SearcherIF
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from interface: SearcherIF
INTERNAL: Releases resources associated with this searcher.

Specified by:
close in interface SearcherIF
Throws:
java.io.IOException

main

public static void main(java.lang.String[] argv)
INTERNAL: Command line version of the searcher.


usage

protected static void usage()


Copyright © 2000-2012 Ontopia.