Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/seq-db/seq-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
DocBlocksZstdLevel: cfg.Compression.DocBlockZstdCompressionLevel,
DocBlockSize: int(cfg.DocsSorting.DocBlockSize),
TokenFreqThresholdPercentage: cfg.Sealing.Tokens.FreqThresholdPercentage,
LIDsBitmapThreshold: cfg.Sealing.Lids.BitmapThreshold,

Check failure on line 278 in cmd/seq-db/seq-db.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)
},
Fraction: frac.Config{
Search: frac.SearchConfig{
Expand Down
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ type Config struct {
Lids struct {
// BlockSize sets max lids (postings) saved per LIDs block.
BlockSize int `config:"block_size" default:"65536"`
// BitmapThreshold specifies minimum number of LIDs in the lid list
// which are serialized as bitmap. LIDs lists with more elements use bitmap encoding,
// while smaller lists use delta encoding.
BitmapThreshold int `config:"bitmap_threshold" default:"65536"`
} `config:"lids"`
} `config:"sealing"`

Expand Down
5 changes: 4 additions & 1 deletion config/frac_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const (

// BinaryDataV5 - token blocks have zone maps (eng letters presense) and doc frequencies for heavy tokens
BinaryDataV5

// BinaryDataV6 - bitmap for sufficiently large LID lists, mixed LIDs block format
BinaryDataV6
)

const CurrentFracVersion = BinaryDataV5
const CurrentFracVersion = BinaryDataV6
1 change: 1 addition & 0 deletions frac/common/seal_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DocBlocksZstdLevel int // DocBlocksZstdLevel is the zstd compress level of each document block.

LIDBlockSize int
LIDsBitmapThreshold int // LIDsBitmapThreshold is the minimum number of LIDs in the lid list to serialize as bitmap.

Check failure on line 16 in frac/common/seal_params.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)
TokenBlockSize int
TokenFreqThresholdPercentage float64
DocBlockSize int // DocBlockSize is decompressed payload size of document block.
Expand Down
13 changes: 13 additions & 0 deletions frac/fraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (s *FractionTestSuite) SetupTestCommon() {
LIDBlockSize: 512,
TokenBlockSize: 128,
DocBlockSize: 128 * int(units.KiB),
LIDsBitmapThreshold: 25,
}

var err error
Expand Down Expand Up @@ -1415,6 +1416,18 @@ func (s *FractionTestSuite) TestSearchLargeFrac() {
fromTime: fromTime,
toTime: toTime,
},
{
name: "complex AND+OR",
query: "(service:gateway OR service:proxy OR service:scheduler) AND " +
"(message:request OR message:failed) AND (level:1 OR level:2 OR level:3)",
filter: func(doc *testDoc) bool {
return (doc.service == gateway || doc.service == proxy || doc.service == "scheduler") &&
(strings.Contains(doc.message, "request") || strings.Contains(doc.message, "failed")) &&
(doc.level >= 1 && doc.level <= 3)
},
fromTime: fromTime,
toTime: toTime,
},
{
name: "service:gateway AND NOT (message:request OR message:timed OR level:[0 to 3])",
query: "service:gateway AND NOT (message:request OR message:timed OR level:[0 to 3])",
Expand Down
10 changes: 5 additions & 5 deletions frac/processor/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ func IndexSearch(
return qpr, nil
}

func batcher(evalTree node.Node, buf []node.LID) func(need int) []node.LID {
func batcher(evalTree node.Node, buf []node.LID, desc bool) func(need int) []node.LID {
if batchNode, ok := tryConvertToBatchedTree(evalTree); ok {
return func(need int) []node.LID {
buf = batchNode.NextBatch().LIDs(buf[:0])
buf = batchNode.NextBatch(need).CopyLIDs(desc, buf[:0])
if len(buf) > need {
buf = buf[:need]
}
Expand Down Expand Up @@ -227,7 +227,7 @@ func iterateEvalTree(
mids := buffers.mids
rids := buffers.rids

batchedEvalTree := batcher(evalTree, buffers.lids)
batchedEvalTree := batcher(evalTree, buffers.lids, params.Order.IsDesc())

timerEval := sw.Timer("eval_tree_next")
timerMID := sw.Timer("get_mid")
Expand Down Expand Up @@ -355,9 +355,9 @@ func sampler(n uint32) func(in []node.LID) []node.LID {
func tryConvertToBatchedTree(evalTree node.Node) (node.BatchedNode, bool) {
switch it := evalTree.(type) {
case *lids.IteratorDesc:
return it, true
return lids.NewBatchedIteratorDesc(it), true
case *lids.IteratorAsc:
return it, true
return lids.NewBatchedIteratorAsc(it), true
default:
return nil, false
}
Expand Down
Loading
Loading