org.apache.nutch.searcher
Class DistributedSearch.Client

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.nutch.searcher.DistributedSearch.Client
All Implemented Interfaces:
Closeable, Runnable, HitContent, HitDetailer, HitInlinks, HitSummarizer, Searcher
Enclosing class:
DistributedSearch

public static class DistributedSearch.Client
extends Thread
implements Searcher, HitDetailer, HitSummarizer, HitContent, HitInlinks, Runnable

The search client.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static long versionID
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DistributedSearch.Client(InetSocketAddress[] addresses, org.apache.hadoop.conf.Configuration conf)
          Construct a client talking to the named servers.
DistributedSearch.Client(org.apache.hadoop.fs.Path file, org.apache.hadoop.conf.Configuration conf)
          Construct a client talking to servers listed in the named file.
 
Method Summary
 void close()
          Stops the watchdog thread.
 String[] getAnchors(HitDetails hit)
          Returns the anchors of a hit document.
 byte[] getContent(HitDetails hit)
          Returns the content of a hit document.
 HitDetails getDetails(Hit hit)
          Returns the details for a hit document.
 HitDetails[] getDetails(Hit[] hits)
          Returns the details for a set of hits.
 String getExplanation(Query query, Hit hit)
          Return an HTML-formatted explanation of how a query scored.
 long getFetchDate(HitDetails hit)
          Returns the fetch date of a hit document.
 Inlinks getInlinks(HitDetails hit)
          Return the inlinks of a hit document.
 boolean[] getLiveServer()
           
 ParseData getParseData(HitDetails hit)
          Returns the ParseData of a hit document.
 ParseText getParseText(HitDetails hit)
          Returns the ParseText of a hit document.
 String[] getSegmentNames()
          Return the names of segments searched.
 Summary[] getSummary(HitDetails[] hits, Query query)
          Returns summaries for a set of details.
 Summary getSummary(HitDetails hit, Query query)
          Returns a summary for the given hit details.
 boolean isFileModified()
          Check to see if search-servers file has been modified
static void main(String[] args)
           
 void run()
           
 Hits search(Query query, int numHits, String dedupField, String sortField, boolean reverse)
          Return the top-scoring hits for a query.
 void updateSegments()
          Updates segment names.
 
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
 

Field Detail

versionID

public static final long versionID
See Also:
Constant Field Values
Constructor Detail

DistributedSearch.Client

public DistributedSearch.Client(org.apache.hadoop.fs.Path file,
                                org.apache.hadoop.conf.Configuration conf)
                         throws IOException
Construct a client talking to servers listed in the named file. Each line in the file lists a server hostname and port, separated by whitespace.

Throws:
IOException

DistributedSearch.Client

public DistributedSearch.Client(InetSocketAddress[] addresses,
                                org.apache.hadoop.conf.Configuration conf)
                         throws IOException
Construct a client talking to the named servers.

Throws:
IOException
Method Detail

isFileModified

public boolean isFileModified()
                       throws IOException
Check to see if search-servers file has been modified

Throws:
IOException

updateSegments

public void updateSegments()
                    throws IOException
Updates segment names.

Throws:
IOException

getSegmentNames

public String[] getSegmentNames()
Return the names of segments searched.


search

public Hits search(Query query,
                   int numHits,
                   String dedupField,
                   String sortField,
                   boolean reverse)
            throws IOException
Description copied from interface: Searcher
Return the top-scoring hits for a query.

Specified by:
search in interface Searcher
Throws:
IOException

getExplanation

public String getExplanation(Query query,
                             Hit hit)
                      throws IOException
Description copied from interface: Searcher
Return an HTML-formatted explanation of how a query scored.

Specified by:
getExplanation in interface Searcher
Throws:
IOException

getDetails

public HitDetails getDetails(Hit hit)
                      throws IOException
Description copied from interface: HitDetailer
Returns the details for a hit document.

Specified by:
getDetails in interface HitDetailer
Throws:
IOException

getDetails

public HitDetails[] getDetails(Hit[] hits)
                        throws IOException
Description copied from interface: HitDetailer
Returns the details for a set of hits. Hook for parallel IPC calls.

Specified by:
getDetails in interface HitDetailer
Throws:
IOException

getSummary

public Summary getSummary(HitDetails hit,
                          Query query)
                   throws IOException
Description copied from interface: HitSummarizer
Returns a summary for the given hit details.

Specified by:
getSummary in interface HitSummarizer
Parameters:
hit - the details of the hit to be summarized
query - indicates what should be higlighted in the summary text
Throws:
IOException

getSummary

public Summary[] getSummary(HitDetails[] hits,
                            Query query)
                     throws IOException
Description copied from interface: HitSummarizer
Returns summaries for a set of details. Hook for parallel IPC calls.

Specified by:
getSummary in interface HitSummarizer
Parameters:
hits - the details of hits to be summarized
query - indicates what should be higlighted in the summary text
Throws:
IOException

getContent

public byte[] getContent(HitDetails hit)
                  throws IOException
Description copied from interface: HitContent
Returns the content of a hit document.

Specified by:
getContent in interface HitContent
Throws:
IOException

getParseData

public ParseData getParseData(HitDetails hit)
                       throws IOException
Description copied from interface: HitContent
Returns the ParseData of a hit document.

Specified by:
getParseData in interface HitContent
Throws:
IOException

getParseText

public ParseText getParseText(HitDetails hit)
                       throws IOException
Description copied from interface: HitContent
Returns the ParseText of a hit document.

Specified by:
getParseText in interface HitContent
Throws:
IOException

getAnchors

public String[] getAnchors(HitDetails hit)
                    throws IOException
Description copied from interface: HitInlinks
Returns the anchors of a hit document.

Specified by:
getAnchors in interface HitInlinks
Throws:
IOException

getInlinks

public Inlinks getInlinks(HitDetails hit)
                   throws IOException
Description copied from interface: HitInlinks
Return the inlinks of a hit document.

Specified by:
getInlinks in interface HitInlinks
Throws:
IOException

getFetchDate

public long getFetchDate(HitDetails hit)
                  throws IOException
Description copied from interface: HitContent
Returns the fetch date of a hit document.

Specified by:
getFetchDate in interface HitContent
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

close

public void close()
Stops the watchdog thread.

Specified by:
close in interface Closeable

getLiveServer

public boolean[] getLiveServer()


Copyright © 2006 The Apache Software Foundation