Skip to content

Commit e85e192

Browse files
authored
Merge pull request #14 from Arkiv-Network/skip-unused-indexes
don't index $txIndex and $opIndex
2 parents da6551d + 34c5790 commit e85e192

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

sqlitestore.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat
204204
nbo := newNumericBitmapOps(st)
205205

206206
for k, v := range numericAttributes {
207+
208+
// skip txIndex and opIndex because they are not used for querying
209+
switch k {
210+
case "$txIndex", "$opIndex":
211+
continue
212+
}
213+
207214
err = nbo.Add(ctx, k, v, id)
208215
if err != nil {
209216
return fmt.Errorf("failed to add numeric attribute value bitmap: %w", err)
@@ -272,6 +279,12 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat
272279
nbo := newNumericBitmapOps(st)
273280

274281
for k, v := range oldNumericAttributes.Values {
282+
// skip txIndex and opIndex because they are not used for querying
283+
switch k {
284+
case "$txIndex", "$opIndex":
285+
continue
286+
}
287+
275288
err = nbo.Remove(ctx, k, v, id)
276289
if err != nil {
277290
return fmt.Errorf("failed to remove numeric attribute value bitmap: %w", err)
@@ -281,6 +294,12 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat
281294
// TODO: delete entity from the indexes
282295

283296
for k, v := range stringAttributes {
297+
// skip txIndex and opIndex because they are not used for querying
298+
switch k {
299+
case "$txIndex", "$opIndex":
300+
continue
301+
}
302+
284303
err = sbo.Add(ctx, k, v, id)
285304
if err != nil {
286305
return fmt.Errorf("failed to add string attribute value bitmap: %w", err)
@@ -325,6 +344,12 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat
325344
nbo := newNumericBitmapOps(st)
326345

327346
for k, v := range oldNumericAttributes.Values {
347+
// skip txIndex and opIndex because they are not used for querying
348+
switch k {
349+
case "$txIndex", "$opIndex":
350+
continue
351+
}
352+
328353
err = nbo.Remove(ctx, k, v, latestPayload.ID)
329354
if err != nil {
330355
return fmt.Errorf("failed to remove numeric attribute value bitmap: %w", err)

0 commit comments

Comments
 (0)