public class Document extends Object implements Barrel, BarrelReader
Case 1: The Document contains just one field (our implementation).
That object represents a Barrel that has just one active document (until it
is removed): the document itself; and it has a set of inverted lists. The
length of each list is one item.
Case 2: The Document contains more fields.
Not supported in this release. Currently, our implementation adds a prefix to
each term. That prefix is computed from the field name and its position in
the tree of fields. For example:
Given the tree structure: [root_field, term1 term2 [child1, term11 term12]
term1 [child2, term1 term2],
Egothor produces these inverted lists:
Users are welcome to implement another format of storing data. Document
implements two basic interfaces: BarrelReader and Barrel. The first one
allows the passing of a Document to a real Barrel (or rather, BarrelWriter)
via BarrelWriter.append(org.egothor.core.BarrelReader)
.
Constructor and Description |
---|
Document()
Constructor for the Document object
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Not implemented but required by Barrel.
|
void |
commit()
Not implemented but required by Barrel.
|
long |
deleted()
Return the number of removed documents.
|
void |
destroy()
Not implemented.
|
Sequence<IListMetadata> |
expand(String expr)
Not implemented.
|
Bitmap |
getBitmap(String label)
Return the Bitmap of a given label.
|
SequenceWithClose<DocumentData> |
getDocuments()
Return an Enumeration of the documents.
|
IListMetadata |
getIListMeta(String term)
Return a simple IListMetadata structure that computes its getLength() as
size()-deleted().
|
SequenceWithClose<IListReader> |
getILists()
Return all inverted lists in A-Z order of terms.
|
DocumentData |
getMeta(long id)
Return the metadata of this document.
|
void |
initialize(DocumentData meta,
FTField root)
Initializator for the Document object.
|
boolean |
isWithoutTerms()
Test whether this document contains at least one term.
|
long |
length()
Return the length of this data structure.
|
BarrelReader |
open()
Return this object.
|
IListReader |
openIList(String term,
boolean clean)
Opens the IListReader of the given
term . |
void |
query(Query q,
ResultList result)
Not implemented..
|
boolean |
removeDoc(long id)
Remove this document if and only if
id is equal to root's
field element UID. |
void |
rewind()
Restart this BarrelReader so that the documents can be read again.
|
void |
setBitmap(String label,
Bitmap bitmap)
Try to set the Bitmap of a given label.
|
long |
size()
Return the size of this data structure.
|
public Bitmap getBitmap(String label)
Barrel
public SequenceWithClose<DocumentData> getDocuments()
getDocuments
in interface BarrelReader
public IListMetadata getIListMeta(String term)
getIListMeta
in interface Barrel
term
- the term for which to search this Document's Hashtablepublic SequenceWithClose<IListReader> getILists()
getILists
in interface BarrelReader
public DocumentData getMeta(long id)
getMeta
in interface Barrel
id
- the ID of the desired documentid
is not equal to
org.egothor.Constants.FIRSTUIDConstants.FIRSTUID
public boolean isWithoutTerms()
public void initialize(DocumentData meta, FTField root)
meta
and
root
to local variables and calls FTField.invertize()
. It prepares the inverted lists structure.meta
- contains the metadata of the Documentroot
- this Document's place in the tree (in this implementation the
tree has one element making this Document the root)public Sequence<IListMetadata> expand(String expr)
public void query(Query q, ResultList result)
public BarrelReader open()
public void destroy()
public long size()
public long length()
length
in interface BarrelReader
public long deleted()
deleted
in interface Barrel
removeDoc(long)
public boolean removeDoc(long id)
id
is equal to root's
field element UID.public void close()
close
in interface AutoCloseable
close
in interface Barrel
close
in interface BarrelReader
public void rewind()
rewind
in interface BarrelReader
public void commit()
public IListReader openIList(String term, boolean clean)
term
.Copyright © 2016 Egothor. All Rights Reserved.