Merge pull request #521 from mschoch/improved-backindex-row
INDEX FORMAT CHANGE: change back index row value
This commit is contained in:
commit
d40cfb0870
|
@ -90,7 +90,7 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult
|
||||||
|
|
||||||
rv.Rows = append(make([]index.IndexRow, 0, rowsCapNeeded), rv.Rows...)
|
rv.Rows = append(make([]index.IndexRow, 0, rowsCapNeeded), rv.Rows...)
|
||||||
|
|
||||||
backIndexTermEntries := make([]*BackIndexTermEntry, 0, rowsCapNeeded)
|
backIndexTermsEntries := make([]*BackIndexTermsEntry, 0, len(fieldTermFreqs))
|
||||||
|
|
||||||
// walk through the collated information and process
|
// walk through the collated information and process
|
||||||
// once for each indexed field (unique name)
|
// once for each indexed field (unique name)
|
||||||
|
@ -99,11 +99,11 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult
|
||||||
includeTermVectors := fieldIncludeTermVectors[fieldIndex]
|
includeTermVectors := fieldIncludeTermVectors[fieldIndex]
|
||||||
|
|
||||||
// encode this field
|
// encode this field
|
||||||
rv.Rows, backIndexTermEntries = udc.indexField(docIDBytes, includeTermVectors, fieldIndex, fieldLength, tokenFreqs, rv.Rows, backIndexTermEntries)
|
rv.Rows, backIndexTermsEntries = udc.indexField(docIDBytes, includeTermVectors, fieldIndex, fieldLength, tokenFreqs, rv.Rows, backIndexTermsEntries)
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the back index row
|
// build the back index row
|
||||||
backIndexRow := NewBackIndexRow(docIDBytes, backIndexTermEntries, backIndexStoredEntries)
|
backIndexRow := NewBackIndexRow(docIDBytes, backIndexTermsEntries, backIndexStoredEntries)
|
||||||
rv.Rows = append(rv.Rows, backIndexRow)
|
rv.Rows = append(rv.Rows, backIndexRow)
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
|
|
|
@ -127,10 +127,12 @@ func (i *IndexReader) DumpDoc(id string) chan interface{} {
|
||||||
}
|
}
|
||||||
// build sorted list of term keys
|
// build sorted list of term keys
|
||||||
keys := make(keyset, 0)
|
keys := make(keyset, 0)
|
||||||
for _, entry := range back.termEntries {
|
for _, entry := range back.termsEntries {
|
||||||
tfr := NewTermFrequencyRow([]byte(*entry.Term), uint16(*entry.Field), idBytes, 0, 0)
|
for i := range entry.Terms {
|
||||||
key := tfr.Key()
|
tfr := NewTermFrequencyRow([]byte(entry.Terms[i]), uint16(*entry.Field), idBytes, 0, 0)
|
||||||
keys = append(keys, key)
|
key := tfr.Key()
|
||||||
|
keys = append(keys, key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sort.Sort(keys)
|
sort.Sort(keys)
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,9 @@ func (i *IndexReader) DocumentFieldTerms(id index.IndexInternalID, fields []stri
|
||||||
fieldsMap[id] = f
|
fieldsMap[id] = f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, entry := range back.termEntries {
|
for _, entry := range back.termsEntries {
|
||||||
if field, ok := fieldsMap[uint16(*entry.Field)]; ok {
|
if field, ok := fieldsMap[uint16(*entry.Field)]; ok {
|
||||||
rv[field] = append(rv[field], *entry.Term)
|
rv[field] = entry.Terms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv, nil
|
return rv, nil
|
||||||
|
|
|
@ -634,7 +634,7 @@ func NewTermFrequencyRowKV(key, value []byte) (*TermFrequencyRow, error) {
|
||||||
|
|
||||||
type BackIndexRow struct {
|
type BackIndexRow struct {
|
||||||
doc []byte
|
doc []byte
|
||||||
termEntries []*BackIndexTermEntry
|
termsEntries []*BackIndexTermsEntry
|
||||||
storedEntries []*BackIndexStoreEntry
|
storedEntries []*BackIndexStoreEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,10 +642,12 @@ func (br *BackIndexRow) AllTermKeys() [][]byte {
|
||||||
if br == nil {
|
if br == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
rv := make([][]byte, len(br.termEntries))
|
rv := make([][]byte, 0, len(br.termsEntries)) // FIXME this underestimates severely
|
||||||
for i, termEntry := range br.termEntries {
|
for _, termsEntry := range br.termsEntries {
|
||||||
termRow := NewTermFrequencyRow([]byte(termEntry.GetTerm()), uint16(termEntry.GetField()), br.doc, 0, 0)
|
for i := range termsEntry.Terms {
|
||||||
rv[i] = termRow.Key()
|
termRow := NewTermFrequencyRow([]byte(termsEntry.Terms[i]), uint16(termsEntry.GetField()), br.doc, 0, 0)
|
||||||
|
rv = append(rv, termRow.Key())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rv
|
return rv
|
||||||
}
|
}
|
||||||
|
@ -686,7 +688,7 @@ func (br *BackIndexRow) Value() []byte {
|
||||||
|
|
||||||
func (br *BackIndexRow) ValueSize() int {
|
func (br *BackIndexRow) ValueSize() int {
|
||||||
birv := &BackIndexRowValue{
|
birv := &BackIndexRowValue{
|
||||||
TermEntries: br.termEntries,
|
TermsEntries: br.termsEntries,
|
||||||
StoredEntries: br.storedEntries,
|
StoredEntries: br.storedEntries,
|
||||||
}
|
}
|
||||||
return birv.Size()
|
return birv.Size()
|
||||||
|
@ -694,20 +696,20 @@ func (br *BackIndexRow) ValueSize() int {
|
||||||
|
|
||||||
func (br *BackIndexRow) ValueTo(buf []byte) (int, error) {
|
func (br *BackIndexRow) ValueTo(buf []byte) (int, error) {
|
||||||
birv := &BackIndexRowValue{
|
birv := &BackIndexRowValue{
|
||||||
TermEntries: br.termEntries,
|
TermsEntries: br.termsEntries,
|
||||||
StoredEntries: br.storedEntries,
|
StoredEntries: br.storedEntries,
|
||||||
}
|
}
|
||||||
return birv.MarshalTo(buf)
|
return birv.MarshalTo(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (br *BackIndexRow) String() string {
|
func (br *BackIndexRow) String() string {
|
||||||
return fmt.Sprintf("Backindex DocId: `%s` Term Entries: %v, Stored Entries: %v", string(br.doc), br.termEntries, br.storedEntries)
|
return fmt.Sprintf("Backindex DocId: `%s` Terms Entries: %v, Stored Entries: %v", string(br.doc), br.termsEntries, br.storedEntries)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBackIndexRow(docID []byte, entries []*BackIndexTermEntry, storedFields []*BackIndexStoreEntry) *BackIndexRow {
|
func NewBackIndexRow(docID []byte, entries []*BackIndexTermsEntry, storedFields []*BackIndexStoreEntry) *BackIndexRow {
|
||||||
return &BackIndexRow{
|
return &BackIndexRow{
|
||||||
doc: docID,
|
doc: docID,
|
||||||
termEntries: entries,
|
termsEntries: entries,
|
||||||
storedEntries: storedFields,
|
storedEntries: storedFields,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -736,7 +738,7 @@ func NewBackIndexRowKV(key, value []byte) (*BackIndexRow, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rv.termEntries = birv.TermEntries
|
rv.termsEntries = birv.TermsEntries
|
||||||
rv.storedEntries = birv.StoredEntries
|
rv.storedEntries = birv.StoredEntries
|
||||||
|
|
||||||
return &rv, nil
|
return &rv, nil
|
||||||
|
|
|
@ -81,19 +81,19 @@ func TestRows(t *testing.T) {
|
||||||
[]byte{168, 202, 1, 195, 235, 163, 130, 4, 255, 1, 1, 3, 11, 1, 0, 0, 150, 17, 23, 31, 2, 1, 2, 0, 3, 43, 51, 3, 3, 4, 5},
|
[]byte{168, 202, 1, 195, 235, 163, 130, 4, 255, 1, 1, 3, 11, 1, 0, 0, 150, 17, 23, 31, 2, 1, 2, 0, 3, 43, 51, 3, 3, 4, 5},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermEntry{{Term: proto.String("beer"), Field: proto.Uint32(0)}}, nil),
|
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermsEntry{{Field: proto.Uint32(0), Terms: []string{"beer"}}}, nil),
|
||||||
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
||||||
[]byte{10, 8, 10, 4, 'b', 'e', 'e', 'r', 16, 0},
|
[]byte{10, 8, 8, 0, 18, 4, 'b', 'e', 'e', 'r'},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermEntry{{Term: proto.String("beer"), Field: proto.Uint32(0)}, {Term: proto.String("beat"), Field: proto.Uint32(1)}}, nil),
|
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermsEntry{{Field: proto.Uint32(0), Terms: []string{"beer"}}, {Field: proto.Uint32(1), Terms: []string{"beat"}}}, nil),
|
||||||
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
||||||
[]byte{10, 8, 10, 4, 'b', 'e', 'e', 'r', 16, 0, 10, 8, 10, 4, 'b', 'e', 'a', 't', 16, 1},
|
[]byte{10, 8, 8, 0, 18, 4, 'b', 'e', 'e', 'r', 10, 8, 8, 1, 18, 4, 'b', 'e', 'a', 't'},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermEntry{{Term: proto.String("beer"), Field: proto.Uint32(0)}, {Term: proto.String("beat"), Field: proto.Uint32(1)}}, []*BackIndexStoreEntry{{Field: proto.Uint32(3)}, {Field: proto.Uint32(4)}, {Field: proto.Uint32(5)}}),
|
NewBackIndexRow([]byte("budweiser"), []*BackIndexTermsEntry{{Field: proto.Uint32(0), Terms: []string{"beer"}}, {Field: proto.Uint32(1), Terms: []string{"beat"}}}, []*BackIndexStoreEntry{{Field: proto.Uint32(3)}, {Field: proto.Uint32(4)}, {Field: proto.Uint32(5)}}),
|
||||||
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
[]byte{'b', 'b', 'u', 'd', 'w', 'e', 'i', 's', 'e', 'r'},
|
||||||
[]byte{10, 8, 10, 4, 'b', 'e', 'e', 'r', 16, 0, 10, 8, 10, 4, 'b', 'e', 'a', 't', 16, 1, 18, 2, 8, 3, 18, 2, 8, 4, 18, 2, 8, 5},
|
[]byte{10, 8, 8, 0, 18, 4, 'b', 'e', 'e', 'r', 10, 8, 8, 1, 18, 4, 'b', 'e', 'a', 't', 18, 2, 8, 3, 18, 2, 8, 4, 18, 2, 8, 5},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewStoredRow([]byte("budweiser"), 0, []uint64{}, byte('t'), []byte("an american beer")),
|
NewStoredRow([]byte("budweiser"), 0, []uint64{}, byte('t'), []byte("an american beer")),
|
||||||
|
@ -310,10 +310,10 @@ func BenchmarkBackIndexRowEncode(b *testing.B) {
|
||||||
field := uint32(1)
|
field := uint32(1)
|
||||||
t1 := "term1"
|
t1 := "term1"
|
||||||
row := NewBackIndexRow([]byte("beername"),
|
row := NewBackIndexRow([]byte("beername"),
|
||||||
[]*BackIndexTermEntry{
|
[]*BackIndexTermsEntry{
|
||||||
{
|
{
|
||||||
Term: &t1,
|
|
||||||
Field: &field,
|
Field: &field,
|
||||||
|
Terms: []string{t1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]*BackIndexStoreEntry{
|
[]*BackIndexStoreEntry{
|
||||||
|
@ -325,12 +325,13 @@ func BenchmarkBackIndexRowEncode(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
row.Key()
|
row.Key()
|
||||||
row.Value()
|
row.Value()
|
||||||
|
b.Logf("%#v", row.Value())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkBackIndexRowDecode(b *testing.B) {
|
func BenchmarkBackIndexRowDecode(b *testing.B) {
|
||||||
k := []byte{0x62, 0x62, 0x65, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65}
|
k := []byte{0x62, 0x62, 0x65, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65}
|
||||||
v := []byte{0x0a, 0x09, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x31, 0x10, 0x01, 0x12, 0x02, 0x08, 0x01}
|
v := []byte{0xa, 0x9, 0x8, 0x1, 0x12, 0x5, 0x74, 0x65, 0x72, 0x6d, 0x31, 0x12, 0x2, 0x8, 0x1}
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_, err := NewBackIndexRowKV(k, v)
|
_, err := NewBackIndexRowKV(k, v)
|
||||||
|
|
|
@ -45,7 +45,7 @@ const RowBufferSize = 4 * 1024
|
||||||
|
|
||||||
var VersionKey = []byte{'v'}
|
var VersionKey = []byte{'v'}
|
||||||
|
|
||||||
const Version uint8 = 5
|
const Version uint8 = 7
|
||||||
|
|
||||||
var IncompatibleVersion = fmt.Errorf("incompatible version, %d is supported", Version)
|
var IncompatibleVersion = fmt.Errorf("incompatible version, %d is supported", Version)
|
||||||
|
|
||||||
|
@ -610,12 +610,13 @@ func encodeFieldType(f document.Field) byte {
|
||||||
return fieldType
|
return fieldType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs analysis.TokenFrequencies, rows []index.IndexRow, backIndexTermEntries []*BackIndexTermEntry) ([]index.IndexRow, []*BackIndexTermEntry) {
|
func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs analysis.TokenFrequencies, rows []index.IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]index.IndexRow, []*BackIndexTermsEntry) {
|
||||||
fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength)))
|
fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength)))
|
||||||
|
|
||||||
termFreqRows := make([]TermFrequencyRow, len(tokenFreqs))
|
termFreqRows := make([]TermFrequencyRow, len(tokenFreqs))
|
||||||
termFreqRowsUsed := 0
|
termFreqRowsUsed := 0
|
||||||
|
|
||||||
|
terms := make([]string, 0, len(tokenFreqs))
|
||||||
for k, tf := range tokenFreqs {
|
for k, tf := range tokenFreqs {
|
||||||
termFreqRow := &termFreqRows[termFreqRowsUsed]
|
termFreqRow := &termFreqRows[termFreqRowsUsed]
|
||||||
termFreqRowsUsed++
|
termFreqRowsUsed++
|
||||||
|
@ -628,13 +629,14 @@ func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fi
|
||||||
}
|
}
|
||||||
|
|
||||||
// record the back index entry
|
// record the back index entry
|
||||||
backIndexTermEntry := BackIndexTermEntry{Term: proto.String(k), Field: proto.Uint32(uint32(fieldIndex))}
|
terms = append(terms, k)
|
||||||
backIndexTermEntries = append(backIndexTermEntries, &backIndexTermEntry)
|
|
||||||
|
|
||||||
rows = append(rows, termFreqRow)
|
rows = append(rows, termFreqRow)
|
||||||
}
|
}
|
||||||
|
backIndexTermsEntry := BackIndexTermsEntry{Field: proto.Uint32(uint32(fieldIndex)), Terms: terms}
|
||||||
|
backIndexTermsEntries = append(backIndexTermsEntries, &backIndexTermsEntry)
|
||||||
|
|
||||||
return rows, backIndexTermEntries
|
return rows, backIndexTermsEntries
|
||||||
}
|
}
|
||||||
|
|
||||||
func (udc *UpsideDownCouch) Delete(id string) (err error) {
|
func (udc *UpsideDownCouch) Delete(id string) (err error) {
|
||||||
|
@ -707,9 +709,11 @@ func (udc *UpsideDownCouch) Delete(id string) (err error) {
|
||||||
func (udc *UpsideDownCouch) deleteSingle(id string, backIndexRow *BackIndexRow, deleteRows []UpsideDownCouchRow) []UpsideDownCouchRow {
|
func (udc *UpsideDownCouch) deleteSingle(id string, backIndexRow *BackIndexRow, deleteRows []UpsideDownCouchRow) []UpsideDownCouchRow {
|
||||||
idBytes := []byte(id)
|
idBytes := []byte(id)
|
||||||
|
|
||||||
for _, backIndexEntry := range backIndexRow.termEntries {
|
for _, backIndexEntry := range backIndexRow.termsEntries {
|
||||||
tfr := NewTermFrequencyRow([]byte(*backIndexEntry.Term), uint16(*backIndexEntry.Field), idBytes, 0, 0)
|
for i := range backIndexEntry.Terms {
|
||||||
deleteRows = append(deleteRows, tfr)
|
tfr := NewTermFrequencyRow([]byte(backIndexEntry.Terms[i]), uint16(*backIndexEntry.Field), idBytes, 0, 0)
|
||||||
|
deleteRows = append(deleteRows, tfr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, se := range backIndexRow.storedEntries {
|
for _, se := range backIndexRow.storedEntries {
|
||||||
sf := NewStoredRow(idBytes, uint16(*se.Field), se.ArrayPositions, 'x', nil)
|
sf := NewStoredRow(idBytes, uint16(*se.Field), se.ArrayPositions, 'x', nil)
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
// DO NOT EDIT!
|
// DO NOT EDIT!
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package upsidedown is a generated protocol buffer package.
|
Package upsidedown is a generated protocol buffer package.
|
||||||
|
|
||||||
It is generated from these files:
|
It is generated from these files:
|
||||||
upsidedown.proto
|
upsidedown.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
BackIndexTermEntry
|
BackIndexTermsEntry
|
||||||
BackIndexStoreEntry
|
BackIndexStoreEntry
|
||||||
BackIndexRowValue
|
BackIndexRowValue
|
||||||
*/
|
*/
|
||||||
package upsidedown
|
package upsidedown
|
||||||
|
|
||||||
|
@ -26,30 +26,30 @@ import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto"
|
||||||
var _ = proto.Marshal
|
var _ = proto.Marshal
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
|
|
||||||
type BackIndexTermEntry struct {
|
type BackIndexTermsEntry struct {
|
||||||
Term *string `protobuf:"bytes,1,req,name=term" json:"term,omitempty"`
|
Field *uint32 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
|
||||||
Field *uint32 `protobuf:"varint,2,req,name=field" json:"field,omitempty"`
|
Terms []string `protobuf:"bytes,2,rep,name=terms" json:"terms,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) Reset() { *m = BackIndexTermEntry{} }
|
func (m *BackIndexTermsEntry) Reset() { *m = BackIndexTermsEntry{} }
|
||||||
func (m *BackIndexTermEntry) String() string { return proto.CompactTextString(m) }
|
func (m *BackIndexTermsEntry) String() string { return proto.CompactTextString(m) }
|
||||||
func (*BackIndexTermEntry) ProtoMessage() {}
|
func (*BackIndexTermsEntry) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) GetTerm() string {
|
func (m *BackIndexTermsEntry) GetField() uint32 {
|
||||||
if m != nil && m.Term != nil {
|
|
||||||
return *m.Term
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) GetField() uint32 {
|
|
||||||
if m != nil && m.Field != nil {
|
if m != nil && m.Field != nil {
|
||||||
return *m.Field
|
return *m.Field
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *BackIndexTermsEntry) GetTerms() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Terms
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type BackIndexStoreEntry struct {
|
type BackIndexStoreEntry struct {
|
||||||
Field *uint32 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
|
Field *uint32 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
|
||||||
ArrayPositions []uint64 `protobuf:"varint,2,rep,name=arrayPositions" json:"arrayPositions,omitempty"`
|
ArrayPositions []uint64 `protobuf:"varint,2,rep,name=arrayPositions" json:"arrayPositions,omitempty"`
|
||||||
|
@ -75,7 +75,7 @@ func (m *BackIndexStoreEntry) GetArrayPositions() []uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type BackIndexRowValue struct {
|
type BackIndexRowValue struct {
|
||||||
TermEntries []*BackIndexTermEntry `protobuf:"bytes,1,rep,name=termEntries" json:"termEntries,omitempty"`
|
TermsEntries []*BackIndexTermsEntry `protobuf:"bytes,1,rep,name=termsEntries" json:"termsEntries,omitempty"`
|
||||||
StoredEntries []*BackIndexStoreEntry `protobuf:"bytes,2,rep,name=storedEntries" json:"storedEntries,omitempty"`
|
StoredEntries []*BackIndexStoreEntry `protobuf:"bytes,2,rep,name=storedEntries" json:"storedEntries,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,9 @@ func (m *BackIndexRowValue) Reset() { *m = BackIndexRowValue{} }
|
||||||
func (m *BackIndexRowValue) String() string { return proto.CompactTextString(m) }
|
func (m *BackIndexRowValue) String() string { return proto.CompactTextString(m) }
|
||||||
func (*BackIndexRowValue) ProtoMessage() {}
|
func (*BackIndexRowValue) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *BackIndexRowValue) GetTermEntries() []*BackIndexTermEntry {
|
func (m *BackIndexRowValue) GetTermsEntries() []*BackIndexTermsEntry {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.TermEntries
|
return m.TermsEntries
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func (m *BackIndexRowValue) GetStoredEntries() []*BackIndexStoreEntry {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) Unmarshal(data []byte) error {
|
func (m *BackIndexTermsEntry) Unmarshal(data []byte) error {
|
||||||
var hasFields [1]uint64
|
var hasFields [1]uint64
|
||||||
l := len(data)
|
l := len(data)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
@ -119,8 +119,26 @@ func (m *BackIndexTermEntry) Unmarshal(data []byte) error {
|
||||||
wireType := int(wire & 0x7)
|
wireType := int(wire & 0x7)
|
||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType)
|
||||||
|
}
|
||||||
|
var v uint32
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := data[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
v |= (uint32(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Field = &v
|
||||||
|
hasFields[0] |= uint64(0x00000001)
|
||||||
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Terms", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
@ -138,28 +156,8 @@ func (m *BackIndexTermEntry) Unmarshal(data []byte) error {
|
||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
s := string(data[iNdEx:postIndex])
|
m.Terms = append(m.Terms, string(data[iNdEx:postIndex]))
|
||||||
m.Term = &s
|
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
hasFields[0] |= uint64(0x00000001)
|
|
||||||
case 2:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType)
|
|
||||||
}
|
|
||||||
var v uint32
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := data[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
v |= (uint32(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.Field = &v
|
|
||||||
hasFields[0] |= uint64(0x00000002)
|
|
||||||
default:
|
default:
|
||||||
var sizeOfWire int
|
var sizeOfWire int
|
||||||
for {
|
for {
|
||||||
|
@ -187,9 +185,6 @@ func (m *BackIndexTermEntry) Unmarshal(data []byte) error {
|
||||||
if hasFields[0]&uint64(0x00000001) == 0 {
|
if hasFields[0]&uint64(0x00000001) == 0 {
|
||||||
return new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
return new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
||||||
}
|
}
|
||||||
if hasFields[0]&uint64(0x00000002) == 0 {
|
|
||||||
return new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -299,7 +294,7 @@ func (m *BackIndexRowValue) Unmarshal(data []byte) error {
|
||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field TermEntries", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field TermsEntries", wireType)
|
||||||
}
|
}
|
||||||
var msglen int
|
var msglen int
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
@ -320,8 +315,8 @@ func (m *BackIndexRowValue) Unmarshal(data []byte) error {
|
||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.TermEntries = append(m.TermEntries, &BackIndexTermEntry{})
|
m.TermsEntries = append(m.TermsEntries, &BackIndexTermsEntry{})
|
||||||
if err := m.TermEntries[len(m.TermEntries)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
|
if err := m.TermsEntries[len(m.TermsEntries)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
@ -472,16 +467,18 @@ var (
|
||||||
ErrInvalidLengthUpsidedown = fmt.Errorf("proto: negative length found during unmarshaling")
|
ErrInvalidLengthUpsidedown = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) Size() (n int) {
|
func (m *BackIndexTermsEntry) Size() (n int) {
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if m.Term != nil {
|
|
||||||
l = len(*m.Term)
|
|
||||||
n += 1 + l + sovUpsidedown(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Field != nil {
|
if m.Field != nil {
|
||||||
n += 1 + sovUpsidedown(uint64(*m.Field))
|
n += 1 + sovUpsidedown(uint64(*m.Field))
|
||||||
}
|
}
|
||||||
|
if len(m.Terms) > 0 {
|
||||||
|
for _, s := range m.Terms {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovUpsidedown(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
if m.XXX_unrecognized != nil {
|
if m.XXX_unrecognized != nil {
|
||||||
n += len(m.XXX_unrecognized)
|
n += len(m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
|
@ -508,8 +505,8 @@ func (m *BackIndexStoreEntry) Size() (n int) {
|
||||||
func (m *BackIndexRowValue) Size() (n int) {
|
func (m *BackIndexRowValue) Size() (n int) {
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.TermEntries) > 0 {
|
if len(m.TermsEntries) > 0 {
|
||||||
for _, e := range m.TermEntries {
|
for _, e := range m.TermsEntries {
|
||||||
l = e.Size()
|
l = e.Size()
|
||||||
n += 1 + l + sovUpsidedown(uint64(l))
|
n += 1 + l + sovUpsidedown(uint64(l))
|
||||||
}
|
}
|
||||||
|
@ -539,7 +536,7 @@ func sovUpsidedown(x uint64) (n int) {
|
||||||
func sozUpsidedown(x uint64) (n int) {
|
func sozUpsidedown(x uint64) (n int) {
|
||||||
return sovUpsidedown(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
return sovUpsidedown(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
}
|
}
|
||||||
func (m *BackIndexTermEntry) Marshal() (data []byte, err error) {
|
func (m *BackIndexTermsEntry) Marshal() (data []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
data = make([]byte, size)
|
data = make([]byte, size)
|
||||||
n, err := m.MarshalTo(data)
|
n, err := m.MarshalTo(data)
|
||||||
|
@ -549,26 +546,33 @@ func (m *BackIndexTermEntry) Marshal() (data []byte, err error) {
|
||||||
return data[:n], nil
|
return data[:n], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *BackIndexTermEntry) MarshalTo(data []byte) (n int, err error) {
|
func (m *BackIndexTermsEntry) MarshalTo(data []byte) (n int, err error) {
|
||||||
var i int
|
var i int
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if m.Term == nil {
|
|
||||||
return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
|
||||||
} else {
|
|
||||||
data[i] = 0xa
|
|
||||||
i++
|
|
||||||
i = encodeVarintUpsidedown(data, i, uint64(len(*m.Term)))
|
|
||||||
i += copy(data[i:], *m.Term)
|
|
||||||
}
|
|
||||||
if m.Field == nil {
|
if m.Field == nil {
|
||||||
return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError)
|
||||||
} else {
|
} else {
|
||||||
data[i] = 0x10
|
data[i] = 0x8
|
||||||
i++
|
i++
|
||||||
i = encodeVarintUpsidedown(data, i, uint64(*m.Field))
|
i = encodeVarintUpsidedown(data, i, uint64(*m.Field))
|
||||||
}
|
}
|
||||||
|
if len(m.Terms) > 0 {
|
||||||
|
for _, s := range m.Terms {
|
||||||
|
data[i] = 0x12
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
data[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
data[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(data[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
if m.XXX_unrecognized != nil {
|
if m.XXX_unrecognized != nil {
|
||||||
i += copy(data[i:], m.XXX_unrecognized)
|
i += copy(data[i:], m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
|
@ -625,8 +629,8 @@ func (m *BackIndexRowValue) MarshalTo(data []byte) (n int, err error) {
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.TermEntries) > 0 {
|
if len(m.TermsEntries) > 0 {
|
||||||
for _, msg := range m.TermEntries {
|
for _, msg := range m.TermsEntries {
|
||||||
data[i] = 0xa
|
data[i] = 0xa
|
||||||
i++
|
i++
|
||||||
i = encodeVarintUpsidedown(data, i, uint64(msg.Size()))
|
i = encodeVarintUpsidedown(data, i, uint64(msg.Size()))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
message BackIndexTermEntry {
|
message BackIndexTermsEntry {
|
||||||
required string term = 1;
|
required uint32 field = 1;
|
||||||
required uint32 field = 2;
|
repeated string terms = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message BackIndexStoreEntry {
|
message BackIndexStoreEntry {
|
||||||
|
@ -9,6 +9,6 @@ message BackIndexStoreEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
message BackIndexRowValue {
|
message BackIndexRowValue {
|
||||||
repeated BackIndexTermEntry termEntries = 1;
|
repeated BackIndexTermsEntry termsEntries = 1;
|
||||||
repeated BackIndexStoreEntry storedEntries = 2;
|
repeated BackIndexStoreEntry storedEntries = 2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user