|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lempinen.neatseeker.core.Repository
Class for handling a repository of Buckets.
The Repository class provides a layer of abstraction over the individual Buckets. A Bucket is a TreeMap containing keyword data for a particular fragment of the entire index (typically, words beginning with same initial letters).
The Repository class is responsible for handling incoming and outgoing keyword requests and directing them to the correct Bucket.
As a secondary task, the Repository also manages a TargetIndex, which complements the keyword data in the Buckets and provides information about the indexed documents (e.g. their URIs, titles etc.)
A Repository can be created read-only or read-write, depending on which constructor you choose. Read-write mode is required for indexing, whereas for searches, you can use the read-only mode. This allows you to use NeatSeeker e.g. in a servlet environment, where the user account that runs the server has only write access to the index.
Bucket
,
TargetIndex
Field Summary | |
private java.util.HashMap |
buckets
The HashMap that holds the individual buckets. |
protected Configuration |
conf
The Configuration object. |
protected TargetIndex |
documents
The TargetIndex object for storing details about the indexed targets. |
protected boolean |
readonly
The read-only flag. |
protected java.lang.String |
root
The root directory of the Bucket repository. |
protected Stemmer |
stemmer
The Stemmer object. |
Constructor Summary | |
Repository(Configuration c)
Creates a new read-write Repository with the given configuration. |
|
Repository(Configuration c,
boolean ro)
Creates a new Repository (read or read-write). |
Method Summary | |
void |
add(Entry entry)
Adds a single key-value pair to this repository. |
void |
cleanup()
Cleans up the repository. |
private java.lang.String |
getBucket(java.lang.String key)
Returns the hashed lowercase bucket name for a particular key. |
long |
getNextID()
Returns the ID of the next Target. |
Target |
getTarget(long id)
Returns a Target from the TargetIndex by its ID. |
private void |
initRepository()
Initialises the repository directory. |
long |
put(Target t)
Adds an object into the TargetIndex and returns a unique ID. |
void |
save()
Writes all Buckets and the TargetIndex onto disk. |
PointerList |
searchSimple(java.lang.String key)
Searches for a particular key in the repository. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.HashMap buckets
protected java.lang.String root
protected TargetIndex documents
protected boolean readonly
protected Configuration conf
protected Stemmer stemmer
Constructor Detail |
public Repository(Configuration c) throws java.io.IOException
public Repository(Configuration c, boolean ro) throws java.io.IOException
Method Detail |
public void add(Entry entry)
public PointerList searchSimple(java.lang.String key)
public void save()
public Target getTarget(long id) throws java.io.IOException, java.lang.ClassNotFoundException
public long getNextID() throws java.io.IOException
public long put(Target t) throws java.io.IOException
private java.lang.String getBucket(java.lang.String key)
public void cleanup()
private void initRepository()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |