websphinx.searchengine
Class Search

java.lang.Object
  |
  +--websphinx.Crawler
        |
        +--websphinx.searchengine.Search
All Implemented Interfaces:
java.util.Enumeration, java.lang.Runnable, java.io.Serializable

public class Search
extends Crawler
implements java.util.Enumeration


Field Summary
 
Fields inherited from class websphinx.Crawler
ALL_LINKS, HYPERLINKS, HYPERLINKS_AND_IMAGES, SERVER, SUBTREE, WEB
 
Constructor Summary
Search()
           
Search(int maxResults)
           
Search(SearchEngine engine, java.lang.String keywords)
           
Search(SearchEngine engine, java.lang.String keywords, int maxResults)
           
 
Method Summary
 void addQuery(SearchEngine engine, java.lang.String keywords)
           
 int count()
           
 boolean hasMoreElements()
           
static void main(java.lang.String[] args)
           
 java.lang.Object nextElement()
           
 SearchEngineResult nextResult()
           
 void run()
          Start crawling.
 void search()
           
 boolean shouldVisit(Link link)
          Callback for testing whether a link should be traversed.
 void visit(Page page)
          Callback for visiting a page.
 
Methods inherited from class websphinx.Crawler
addClassifier, addCrawlListener, addLinkListener, addRoot, clear, clearVisited, enumerateClassifiers, enumerateQueue, expand, getAction, getActiveThreads, getClassifiers, getCrawledRoots, getDepthFirst, getDomain, getDownloadParameters, getIgnoreVisitedLinks, getLinkPredicate, getLinksTested, getLinkType, getMaxDepth, getName, getPagePredicate, getPagesLeft, getPagesVisited, getRootHrefs, getRoots, getState, getSynchronous, markVisited, pause, removeAllClassifiers, removeClassifier, removeCrawlListener, removeLinkListener, sendCrawlEvent, sendLinkEvent, sendLinkEvent, setAction, setDepthFirst, setDomain, setDownloadParameters, setIgnoreVisitedLinks, setLinkPredicate, setLinkType, setMaxDepth, setName, setPagePredicate, setRoot, setRootHrefs, setRoots, setSynchronous, stop, submit, submit, toString, visited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Search

public Search()

Search

public Search(int maxResults)

Search

public Search(SearchEngine engine,
              java.lang.String keywords,
              int maxResults)

Search

public Search(SearchEngine engine,
              java.lang.String keywords)
Method Detail

addQuery

public void addQuery(SearchEngine engine,
                     java.lang.String keywords)

search

public void search()

count

public int count()

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration

nextResult

public SearchEngineResult nextResult()

run

public void run()
Description copied from class: Crawler
Start crawling. Returns either when the crawl is done, or when pause() or stop() is called. Because this method implements the java.lang.Runnable interface, a crawler can be run in the background thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class Crawler

visit

public void visit(Page page)
Description copied from class: Crawler
Callback for visiting a page. Default version does nothing.

Overrides:
visit in class Crawler
Following copied from class: websphinx.Crawler
Parameters:
page - Page retrieved by the crawler

shouldVisit

public boolean shouldVisit(Link link)
Description copied from class: Crawler
Callback for testing whether a link should be traversed. Default version returns true for all links. Override this method for more interesting behavior.

Overrides:
shouldVisit in class Crawler
Following copied from class: websphinx.Crawler
Parameters:
l - Link encountered by the crawler
Returns:
true if link should be followed, false if it should be ignored.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception