projects
/
SXSI
/
TextCollection.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Construction time&space fix
[SXSI/TextCollection.git]
/
TextStorage.h
diff --git
a/TextStorage.h
b/TextStorage.h
index
237bc44
..
3da3a1d
100644
(file)
--- a/
TextStorage.h
+++ b/
TextStorage.h
@@
-35,8
+35,7
@@
public:
// Define a shortcut
typedef TextCollection::TextPosition TextPosition;
// Block size in DeltaVector
// Define a shortcut
typedef TextCollection::TextPosition TextPosition;
// Block size in DeltaVector
- const static CSA::usint DV_BLOCK_SIZE = 16;
-
+ const static CSA::usint DV_BLOCK_SIZE = 32;
TextStorage(uchar *text, TextPosition n)
: n_(n), text_(text), offsets_(0), numberOfTexts_(0)
TextStorage(uchar *text, TextPosition n)
: n_(n), text_(text), offsets_(0), numberOfTexts_(0)
@@
-77,13
+76,23
@@
public:
uchar * GetText(TextCollection::DocId docId)
{
uchar * GetText(TextCollection::DocId docId)
{
- assert(docId < numberOfTexts_);
+ assert(docId <
(TextCollection::DocId)
numberOfTexts_);
TextPosition offset = offsets_->select(docId);
return &text_[offset];
}
TextPosition offset = offsets_->select(docId);
return &text_[offset];
}
+ TextCollection::DocId DocIdAtTextPos(TextCollection::TextPosition i)
+ {
+ assert(i < n_);
+ return offsets_->rank(i)-1;
+ }
+ TextCollection::TextPosition TextStartPos(TextCollection::DocId i)
+ {
+ assert(i < (TextCollection::DocId)numberOfTexts_);
+ return offsets_->select(i);
+ }
private:
void initOffsets()
private:
void initOffsets()