func (f *Firestorm) storeField(docID []byte, docNum uint64, field document.Field, fieldIndex uint16) index.IndexRow { fieldValue := make([]byte, 1+len(field.Value())) fieldValue[0] = encodeFieldType(field) copy(fieldValue[1:], field.Value()) storedRow := NewStoredRow(docID, docNum, fieldIndex, field.ArrayPositions(), fieldValue) return storedRow }
func (udc *UpsideDownCouch) storeField(docID []byte, field document.Field, fieldIndex uint16, rows []index.IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]index.IndexRow, []*BackIndexStoreEntry) { fieldType := encodeFieldType(field) storedRow := NewStoredRow(docID, fieldIndex, field.ArrayPositions(), fieldType, field.Value()) // record the back index entry backIndexStoredEntry := BackIndexStoreEntry{Field: proto.Uint32(uint32(fieldIndex)), ArrayPositions: field.ArrayPositions()} return append(rows, storedRow), append(backIndexStoredEntries, &backIndexStoredEntry) }