net.nutch.searcher
Class NutchBean

java.lang.Object
  extended bynet.nutch.searcher.NutchBean
All Implemented Interfaces:
HitContent, HitDetailer, HitSummarizer, Searcher

public class NutchBean
extends Object
implements Searcher, HitDetailer, HitSummarizer, HitContent

One stop shopping for search-related functionality.

Version:
$Id: NutchBean.java,v 1.12 2004/08/03 20:48:34 cutting Exp $

Field Summary
static Logger LOG
           
 
Constructor Summary
NutchBean()
          Construct reading from connected directory.
NutchBean(File dir)
          Construct in a named directory.
 
Method Summary
static NutchBean get(javax.servlet.ServletContext app)
          Cache in servlet context.
 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.
 ParseData getParseData(HitDetails hit)
          Returns the ParseData of a hit document.
 String[] getSegmentNames()
           
 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)
          For debugging.
 Hits search(Query query, int numHits)
          Return the top-scoring hits for a query.
 Hits search(Query query, int numHits, int maxHitsPerSite)
          Search for pages matching a query, eliminating excessive hits from sites.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final Logger LOG
Constructor Detail

NutchBean

public NutchBean()
          throws IOException
Construct reading from connected directory.


NutchBean

public NutchBean(File dir)
          throws IOException
Construct in a named directory.

Method Detail

get

public static NutchBean get(javax.servlet.ServletContext app)
                     throws IOException
Cache in servlet context.

Throws:
IOException

getSegmentNames

public String[] getSegmentNames()

search

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

Specified by:
search in interface Searcher
Throws:
IOException

search

public Hits search(Query query,
                   int numHits,
                   int maxHitsPerSite)
            throws IOException
Search for pages matching a query, eliminating excessive hits from sites. Hits for a site in excess of maxHitsPerSite are removed from the results. The remaining hits for such sites have Hit.moreFromSiteExcluded() set.

If maxHitsPerSite is zero then all hits are returned.

Parameters:
query - query
numHits - number of requested hits
maxHitsPerSite - the maximum hits returned per site, or zero
Returns:
Hits the matching hits
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

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

main

public static void main(String[] args)
                 throws Exception
For debugging.

Throws:
Exception


Copyright © 2004 The Nutch Organization.