API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.search.simpleindexer. JOTSimpleSearchEngine View Source
Author(s)
thibautc
Since
Version
Serial
Hierarchy
 Object
      JOTSimpleSearchEngine
Implements
Subclasses
Description
public class JOTSimpleSearchEngine
  Implement a simple search engine using a text/keyword index Use(or extend) to index/search plain text pfiles.
See also:   
Constructors
public JOTSimpleSearchEngine (File indexRoot) throws Exception
 
Methods
Hide/Show inherited methods
protected int commitFromMemory (String id, Hashtable hash) throws Exception
  Writes the temporary -in memory- hash to the index files.
public int indexFile (File textFile) throws Exception
  Index the file using the filepath as the unique key, and only reindexing if file timestamp was updated
public int indexFile (File textFile, boolean onlyIfModified) throws Exception
  Index the file using the filepath as the unique key
public int indexFile (File textFile, String uniqueId) throws Exception
  Index the file, only if the timestamp chnaged since the last indexing.
public int indexFile (File textFile, String uniqueId, boolean onlyIfModified) throws Exception
  index a file(update if already indexed)
protected int indexLineInMemory (Hashtable hash, String lineNb, String s)
  mem is the hashtable storing the keyword data.
publicstatic void main (String args)
  for testing / Example
publicstatic String parseQueryIntoKeywords (String queryString)
  Utility method to parse a user typed query (ex: "a java server pAGes ") into keywords ex: [java,server,pages]
public JOTRawSearchResult performRawSearch (String keywords) throws Exception
  return an array of rawSearchResults (one rawsearchresult per keyword, in the same order as the keywords).
public JOTSearchResult performSearch (String keywords, JOTSearchSorter sorter) throws Exception
  return sorted list of files(uniqueIds) and score (1-5)
public int removeFile (File textFile, String uniqueId) throws Exception
  remove a file from the index
protected void updateKeywordsCount (int nbNewKeywords) throws Exception
publicstatic void whipeoutIndex (File indexRoot)
completely whipeout the index, so you can reindex from scratch Simply deletes everyhting in the indexRoot folder !
Fields
Hide/Show inherited fields
protectedstatic JOTSearchSorter defaultSorter
pack-private JOTIndexHandler indexHandler
public File indexRoot
index property file
protectedstatic Pattern pattern
Pattern matching "words" a single word is considered any letter or number (unicode case insensitive) as well as - and _
protected File propFile
public JOTPropertiesPreferences props
protected int WORD_BATCH_SIZE
Max words to process in memory before writing to file Too low, and performance will be slower Too high and it will use more memory.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar