org.gcube.indexmanagement.lucenewrapper
Class LuceneSearchWorker

java.lang.Object
  extended by java.lang.Thread
      extended by org.gcube.indexmanagement.lucenewrapper.LuceneSearchWorker
All Implemented Interfaces:
Runnable

public class LuceneSearchWorker
extends Thread

A worker thread to take care of the ResultSet feeding after a query


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LuceneSearchWorker(gr.uoa.di.madgik.grs.writer.RecordWriter<gr.uoa.di.madgik.grs.record.GenericRecord> rsWriter, org.apache.lucene.index.IndexReader reader, QueryTerm[] terms, org.apache.lucene.search.Hits queryHits, int numberOfHits, FullTextIndexType idxType, boolean isComplete, ArrayList<String> presentable, LinkedHashMap<String,String> projections, QuerySnippetTermsPair querySnippetTermsPair, RRadaptor adaptor)
          The constructor
 
Method Summary
 int getFreq(Enumeration fields, String termString, int docID)
          A method used to the Term frequency of the term termString for multiple fields in the document(docID).
 int getFreq(org.apache.lucene.index.Term t, int docID)
          A method used to count the occurrence frequency of a Term in a Document.
 void run()
          
 void setMaximumSnippetsCount(Integer maximumSnippetsCount)
           
 void setSnippetSize(Integer snippetSize)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LuceneSearchWorker

public LuceneSearchWorker(gr.uoa.di.madgik.grs.writer.RecordWriter<gr.uoa.di.madgik.grs.record.GenericRecord> rsWriter,
                          org.apache.lucene.index.IndexReader reader,
                          QueryTerm[] terms,
                          org.apache.lucene.search.Hits queryHits,
                          int numberOfHits,
                          FullTextIndexType idxType,
                          boolean isComplete,
                          ArrayList<String> presentable,
                          LinkedHashMap<String,String> projections,
                          QuerySnippetTermsPair querySnippetTermsPair,
                          RRadaptor adaptor)
The constructor

Parameters:
rsWriter - - The ResultSet writer to be used by the new LuceneSearchWorker thread.
reader - - An IndexReader to be used in order to find Query statistics.
terms - - QueryTerms from the Lucene query.
queryHits - - The hits resulting from the Lucene query
numberOfHits - - The number of hits from the Lucene query
idxType - - The IndexType of the queried Index.
presentable -
querySnippetTermsPair -
Method Detail

setSnippetSize

public void setSnippetSize(Integer snippetSize)

setMaximumSnippetsCount

public void setMaximumSnippetsCount(Integer maximumSnippetsCount)

run

public void run()

Specified by:
run in interface Runnable
Overrides:
run in class Thread

getFreq

public int getFreq(org.apache.lucene.index.Term t,
                   int docID)
            throws IOException
A method used to count the occurrence frequency of a Term in a Document.

Parameters:
t - - The Term of which to count the occurrences.
docID - - The Document in which to count the Term frequency.
Returns:
The requested Term frequency.
Throws:
IOException - An error reading from the Lucene Index.

getFreq

public int getFreq(Enumeration fields,
                   String termString,
                   int docID)
            throws IOException
A method used to the Term frequency of the term termString for multiple fields in the document(docID).

Parameters:
fields - - The fields to include in term fequency count.
termString - - The term text of which to count the occurrences.
docID - - The document in which to count the term frequency.
Returns:
The requested Term frequency.
Throws:
IOException - An error reading from the Lucene Index.


Copyright © 2012. All Rights Reserved.