zyh.robot
Class ContentSorter

java.lang.Object
  |
  +--zyh.robot.ContentSorter

public class ContentSorter
extends java.lang.Object
implements ContentProcessor

Uses ContentSorter to extract the keywords from Content object, and maintain the keywords index dabase. This ContentProcessor will filter stopword(noise word) and calculate the weight according to its quoted frequency and quoted location. The incorporate of synonyms, plural and p.p are not complemented.

See Also:
ContentProcessor, Content

Constructor Summary
ContentSorter(java.lang.String jdbcurl, java.lang.String keywordTableName, java.lang.String stopwordTableName)
          Creates a ContentSorter object
 
Method Summary
 void close()
          Uses to release all occupied resource by this content processor
 int[] getWordIDs(Content content)
          Sort and Index a content object.
static int[] sortURLs(int urlsColumnIndex, java.sql.ResultSet resultSet)
          Search.java use this function to sort the url list which is gotten from OR operator.
static int[] sortURLs(int urlsColumnIndex, java.sql.ResultSet resultSet, java.lang.String[] sqls, java.sql.Statement statement)
          Search.java use this function to extract the url list which is gotten from AND operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentSorter

public ContentSorter(java.lang.String jdbcurl,
                     java.lang.String keywordTableName,
                     java.lang.String stopwordTableName)
              throws java.sql.SQLException
Creates a ContentSorter object
Parameters:
jdbcurl - the jdbcurl for the stopword databse and keyword database
keywordTableName - the table name which contains all keywords
stopwordTableName - the table name which contains all stopwords
Method Detail

close

public void close()
           throws java.sql.SQLException
Uses to release all occupied resource by this content processor
Specified by:
close in interface ContentProcessor
Tags copied from interface: ContentProcessor
Throws:
SQLException - if an index database access error occurs

getWordIDs

public int[] getWordIDs(Content content)
                 throws java.sql.SQLException
Sort and Index a content object.
Specified by:
getWordIDs in interface ContentProcessor
Parameters:
content - an Content object
Returns:
a wordID array of all keywords from the content
Throws:
java.sql.SQLException - if an index database access error occurs

sortURLs

public static final int[] sortURLs(int urlsColumnIndex,
                                   java.sql.ResultSet resultSet)
                            throws java.sql.SQLException
Search.java use this function to sort the url list which is gotten from OR operator.
Parameters:
urlsColumnIndex - the index of a column which contains URLs object
resultSet - a resultset contains "urls" column at least
Returns:
a sorted urlID array according to their word weight

sortURLs

public static final int[] sortURLs(int urlsColumnIndex,
                                   java.sql.ResultSet resultSet,
                                   java.lang.String[] sqls,
                                   java.sql.Statement statement)
                            throws java.sql.SQLException
Search.java use this function to extract the url list which is gotten from AND operator.
Parameters:
urlsColumnIndex - the index of a column which contains URLs object
resultSet - a resultset contains "urls" column at least
sqls - some sql commands
statement - a statement
Returns:
a sorted urlID array according to their word weight