change module name 10
This commit is contained in:
@@ -133,7 +133,7 @@ func (s *MemcachedIndexStore) Lookup(collection, field, value string) ([]IndexPo
|
||||
}
|
||||
|
||||
// Rebuild перестраивает вклад партиции в индекс.
|
||||
func (s *MemcachedIndexStore) Rebuild(collection, partition string, fields []string, records []any) error {
|
||||
func (s *MemcachedIndexStore) Rebuild(collection, partition string, fields []string, records []any, lineIndexes []int) error {
|
||||
if partition == "" {
|
||||
partition = DefaultPartition
|
||||
}
|
||||
@@ -155,7 +155,11 @@ func (s *MemcachedIndexStore) Rebuild(collection, partition string, fields []str
|
||||
// встречаются в records. Для остальных value старые позиции этой partition останутся.
|
||||
// Значит нужен merge: для каждого value в records делаем Get, убираем старые Position с этой partition, добавляем новые.
|
||||
byFieldValue := make(map[string]map[string][]IndexPosition)
|
||||
for idx, rec := range records {
|
||||
for i, rec := range records {
|
||||
lineIdx := i
|
||||
if lineIndexes != nil && i < len(lineIndexes) {
|
||||
lineIdx = lineIndexes[i]
|
||||
}
|
||||
recMap, ok := rec.(map[string]any)
|
||||
if !ok {
|
||||
continue
|
||||
@@ -165,7 +169,7 @@ func (s *MemcachedIndexStore) Rebuild(collection, partition string, fields []str
|
||||
if byFieldValue[field] == nil {
|
||||
byFieldValue[field] = make(map[string][]IndexPosition)
|
||||
}
|
||||
byFieldValue[field][val] = append(byFieldValue[field][val], IndexPosition{Partition: partition, LineIndex: idx})
|
||||
byFieldValue[field][val] = append(byFieldValue[field][val], IndexPosition{Partition: partition, LineIndex: lineIdx})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user