public class Indexer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
addCount
A count of objects processed by
addObject(ObjectContent) method. |
int |
output
This field manages an output to console.
|
Constructor and Description |
---|
Indexer(java.lang.String indexfile,
boolean createNew)
Opens an existing index file or creates a new empty index if the indexfile is not found.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(ObjectContent c)
Adds an
ObjectContent object to an index. |
void |
addPath(java.lang.String dir,
java.lang.String[] listFilter)
Add files of directory
dir and subdirectories to the search index. |
void |
prepareIndex()
Performs a final operations to finalize indexing.
|
public int output
public int addCount
addObject(ObjectContent)
method.public Indexer(java.lang.String indexfile, boolean createNew) throws java.sql.SQLException, java.lang.ClassNotFoundException
indexfile
- a full name of the index file.createNew
- if true then always creates a new empty index file.
If the index file exists then deletes the existing index and creates an empty new one.
java.sql.SQLException
java.lang.ClassNotFoundException
public void addObject(ObjectContent c) throws java.sql.SQLException
ObjectContent
object to an index. Increments an addCount
field.
This method uses StopList
global object to filter stop words that are discarded
from indexing.c
- indexing objectjava.sql.SQLException
StopList
,
ObjectContent
public void addPath(java.lang.String dir, java.lang.String[] listFilter) throws java.sql.SQLException
dir
and subdirectories to the search index.
FileContent
object for each
found file and calls addObject(ObjectContent)
method to add each
FileContent object to an index.dir
- a directory to be indexed.listFilter
- an array of included or excluded file patterns with wildcards (*?).
If the listFilter is null or empty then all files will be indexed.
If a pattern begins with '-' character then it defines exclude rule, otherwise it is an include pattern.
If a file name matches include and exclude pattern simultaneously then the
file will be excluded from indexing.
For example:
listFilter={"*.doc","*.rtf"}
includes only .doc and .rtf files
listFilter={"-*.exe","-*.dll"}
includes all files except .exe,.dll
listFilter={"*.doc","-c:\xxx\bin\*"}
includes all .doc files except
any files in subdirectory c:\xxx\bin\
java.sql.SQLException
StopList
,
addCount
,
addObject(org.fts7.ObjectContent)
,
ObjectContent
public void prepareIndex() throws java.sql.SQLException
addPath(String, String[])
or addObject(ObjectContent)
methods.java.sql.SQLException