org.apache.nutch.searcher
Class DistributedSearch.Client

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.apache.nutch.searcher.DistributedSearch.Client
All Implemented Interfaces:
HitContent, HitDetailer, HitSummarizer, Runnable, Searcher
Enclosing class:
DistributedSearch

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

The search client.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DistributedSearch.Client(File file)
          Construct a client talking to servers listed in the named file.
DistributedSearch.Client(InetSocketAddress[] addresses)
          Construct a client talking to the named servers.
 
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 anchors of a hit document.
 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.
 String[] getSummary(HitDetails[] hits, Query query)
          Returns summaries for a set of details.
 String getSummary(HitDetails hit, Query query)
          Returns a summary for the given hit details.
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, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

DistributedSearch.Client

public DistributedSearch.Client(File file)
                         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.


DistributedSearch.Client

public DistributedSearch.Client(InetSocketAddress[] addresses)
                         throws IOException
Construct a client talking to the named servers.

Method Detail

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 String 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 String[] 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: HitContent
Returns the anchors of a hit document.

Specified by:
getAnchors in interface HitContent
Throws:
IOException

getFetchDate

public long getFetchDate(HitDetails hit)
                  throws IOException
Description copied from interface: HitContent
Returns the anchors 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

close

public void close()
Stops the watchdog thread.



Copyright © 2006 The Apache Software Foundation