org.gcube.indexmanagement.lucenewrapper
Class LuceneSearcher

java.lang.Object
  extended by org.gcube.indexmanagement.lucenewrapper.LuceneSearcher
All Implemented Interfaces:
IndexSearch

public class LuceneSearcher
extends Object
implements IndexSearch

An IndexSerch implementation used to search a Lucene index.


Nested Class Summary
static class LuceneSearcher.SupportedRelations
           
 
Field Summary
static String ALL_INDEXES
           
static String EQUALS
           
 ArrayList<String> fieldNames
           
 
Constructor Summary
LuceneSearcher()
           
LuceneSearcher(String lemmatizerPluginName, String configFilePath, Language defaultLanguage)
          constructor
 
Method Summary
 void closeIndex()
          Closes the previously opened index
 URI executeCqlQuery(ArrayList<String> presentable, ArrayList<String> searchable, String queryString, boolean isComplete, RRadaptor adaptor)
          Fills the RSClient with results from executing the queryString on an index (Lucene only).
 URI executeQuery(String queryString, boolean isComplete)
          Deprecated. - This method applies a query expansion, before executing the query, that assumes an old Index version was used (Index Library version < 3.0.0) Fills the RSClient with results from executing the queryString on an index (Lucene only).

Setting client to null will print results to system.out.

 String expandQuery(String query, String defaultLemLang, String defaultLang, boolean onlyLemByDefault)
           
 void openIndex(String indexDir, String indexName)
          Opens the index for search operations
 void setIndexType(FullTextIndexType idxType)
          Updates the IndexSearch' state object
 void setMaximumSnippetsCount(Integer maximumSnippetsCount)
           
 void setSnippetSize(Integer snippetSize)
           
 void updateIndex()
          Updates the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUALS

public static final String EQUALS
See Also:
Constant Field Values

ALL_INDEXES

public static final String ALL_INDEXES
See Also:
Constant Field Values

fieldNames

public ArrayList<String> fieldNames
Constructor Detail

LuceneSearcher

public LuceneSearcher(String lemmatizerPluginName,
                      String configFilePath,
                      Language defaultLanguage)
               throws Exception
constructor

Throws:
Exception

LuceneSearcher

public LuceneSearcher()
               throws Exception
Throws:
Exception
Method Detail

setSnippetSize

public void setSnippetSize(Integer snippetSize)

setMaximumSnippetsCount

public void setMaximumSnippetsCount(Integer maximumSnippetsCount)

openIndex

public void openIndex(String indexDir,
                      String indexName)
               throws IndexException
Opens the index for search operations

Specified by:
openIndex in interface IndexSearch
Parameters:
indexDir - the base directory where indices are stored
indexName - name of the index
Throws:
IndexException - - an error opening the index

updateIndex

public void updateIndex()
                 throws IndexException
Updates the index.

Specified by:
updateIndex in interface IndexSearch
Throws:
IndexException - - an error updating the index

setIndexType

public void setIndexType(FullTextIndexType idxType)
                  throws IndexException
Updates the IndexSearch' state object

Specified by:
setIndexType in interface IndexSearch
Throws:
IndexException - - an error setting the IndexType

closeIndex

public void closeIndex()
                throws IndexException
Closes the previously opened index

Specified by:
closeIndex in interface IndexSearch
Throws:
IndexException - - an error closing the index

executeCqlQuery

public URI executeCqlQuery(ArrayList<String> presentable,
                           ArrayList<String> searchable,
                           String queryString,
                           boolean isComplete,
                           RRadaptor adaptor)
                    throws Exception
Fills the RSClient with results from executing the queryString on an index (Lucene only).

Setting client to null will print results to system.out.

Specified by:
executeCqlQuery in interface IndexSearch
Parameters:
presentable - the field Names of the fields that are presentable in this index
searchable - the field Names of the fields that are searchable in this index
queryString - executed query string
isComplete - indicates if the results must contain the full payload
Returns:
number of hits in index (may differe from records in resultset).
Throws:
IndexException - - an error executing the query
Exception

executeQuery

public URI executeQuery(String queryString,
                        boolean isComplete)
                 throws IndexException
Deprecated. - This method applies a query expansion, before executing the query, that assumes an old Index version was used (Index Library version < 3.0.0) Fills the RSClient with results from executing the queryString on an index (Lucene only).

Setting client to null will print results to system.out.

Description copied from interface: IndexSearch
Fills the RSClient with results from executing the queryString on an index (Lucene only).

Setting client to null will print results to system.out.

Specified by:
executeQuery in interface IndexSearch
Parameters:
queryString - executed query string
isComplete - indicates if the results must contain the full payload
Returns:
number of hits in index (may differe from records in resultset).
Throws:
IndexException - - an error executing the query

expandQuery

public String expandQuery(String query,
                          String defaultLemLang,
                          String defaultLang,
                          boolean onlyLemByDefault)
                   throws IndexException
Throws:
IndexException


Copyright © 2013. All Rights Reserved.