commit
fa7e3f811b
6
index.go
6
index.go
|
@ -71,7 +71,7 @@ func (b *Batch) Size() int {
|
||||||
return len(b.internal.IndexOps) + len(b.internal.InternalOps)
|
return len(b.internal.IndexOps) + len(b.internal.InternalOps)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String prints a user friendly string represenation of what
|
// String prints a user friendly string representation of what
|
||||||
// is inside this batch.
|
// is inside this batch.
|
||||||
func (b *Batch) String() string {
|
func (b *Batch) String() string {
|
||||||
return b.internal.String()
|
return b.internal.String()
|
||||||
|
@ -202,7 +202,7 @@ type Index interface {
|
||||||
SetInternal(key, val []byte) error
|
SetInternal(key, val []byte) error
|
||||||
DeleteInternal(key []byte) error
|
DeleteInternal(key []byte) error
|
||||||
|
|
||||||
// Name returns the name of the index (by deault this is the path)
|
// Name returns the name of the index (by default this is the path)
|
||||||
Name() string
|
Name() string
|
||||||
// SetName lets you assign your own logical name to this index
|
// SetName lets you assign your own logical name to this index
|
||||||
SetName(string)
|
SetName(string)
|
||||||
|
@ -230,7 +230,7 @@ func New(path string, mapping *IndexMapping) (Index, error) {
|
||||||
// The provided mapping will be used for all
|
// The provided mapping will be used for all
|
||||||
// Index/Search operations.
|
// Index/Search operations.
|
||||||
// The specified index type will be used
|
// The specified index type will be used
|
||||||
// The specified kvstore implemenation will be used
|
// The specified kvstore implementation will be used
|
||||||
// and the provided kvconfig will be passed to its
|
// and the provided kvconfig will be passed to its
|
||||||
// constructor.
|
// constructor.
|
||||||
func NewUsing(path string, mapping *IndexMapping, indexType string, kvstore string, kvconfig map[string]interface{}) (Index, error) {
|
func NewUsing(path string, mapping *IndexMapping, indexType string, kvstore string, kvconfig map[string]interface{}) (Index, error) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ type KVIterator interface {
|
||||||
// to do this in a way that is safe and makes sense
|
// to do this in a way that is safe and makes sense
|
||||||
type KVWriter interface {
|
type KVWriter interface {
|
||||||
|
|
||||||
// NewBatch returns a KVBatch for performaing batch operations on this kvstore
|
// NewBatch returns a KVBatch for performing batch operations on this kvstore
|
||||||
NewBatch() KVBatch
|
NewBatch() KVBatch
|
||||||
|
|
||||||
// ExecuteBatch will execute the KVBatch, the provided KVBatch **MUST** have
|
// ExecuteBatch will execute the KVBatch, the provided KVBatch **MUST** have
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/blevesearch/bleve/index/store"
|
"github.com/blevesearch/bleve/index/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// tests focused on verfiying that readers are isolated from writers
|
// tests focused on verifying that readers are isolated from writers
|
||||||
|
|
||||||
func CommonTestReaderIsolation(t *testing.T, s store.KVStore) {
|
func CommonTestReaderIsolation(t *testing.T, s store.KVStore) {
|
||||||
// insert a kv pair
|
// insert a kv pair
|
||||||
|
@ -30,7 +30,7 @@ func CommonTestReaderIsolation(t *testing.T, s store.KVStore) {
|
||||||
// reader is closed.
|
// reader is closed.
|
||||||
// in general this is not a problem for bleve
|
// in general this is not a problem for bleve
|
||||||
// (though it may affect performance in some cases)
|
// (though it may affect performance in some cases)
|
||||||
// but it is a problem for this test which attemps
|
// but it is a problem for this test which attempts
|
||||||
// to easily verify that readers are isolated
|
// to easily verify that readers are isolated
|
||||||
// this hack writes enough initial data such that
|
// this hack writes enough initial data such that
|
||||||
// the subsequent writes do not require additional
|
// the subsequent writes do not require additional
|
||||||
|
|
|
@ -438,7 +438,7 @@ func (i *indexAliasImpl) Swap(in, out []Index) {
|
||||||
// createChildSearchRequest creates a separate
|
// createChildSearchRequest creates a separate
|
||||||
// request from the original
|
// request from the original
|
||||||
// For now, avoid data race on req structure.
|
// For now, avoid data race on req structure.
|
||||||
// TODO disable highligh/field load on child
|
// TODO disable highlight/field load on child
|
||||||
// requests, and add code to do this only on
|
// requests, and add code to do this only on
|
||||||
// the actual final results.
|
// the actual final results.
|
||||||
// Perhaps that part needs to be optional,
|
// Perhaps that part needs to be optional,
|
||||||
|
|
|
@ -172,7 +172,7 @@ func openIndexUsing(path string, runtimeConfig map[string]interface{}) (rv *inde
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// backwards compatability if index type is missing
|
// backwards compatibility if index type is missing
|
||||||
if rv.meta.IndexType == "" {
|
if rv.meta.IndexType == "" {
|
||||||
rv.meta.IndexType = upside_down.Name
|
rv.meta.IndexType = upside_down.Name
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ type fuzzyQuery struct {
|
||||||
// fuzziness of the specified term.
|
// fuzziness of the specified term.
|
||||||
// The default fuzziness is 2.
|
// The default fuzziness is 2.
|
||||||
//
|
//
|
||||||
// The current implementation uses Leveshtein edit
|
// The current implementation uses Levenshtein edit
|
||||||
// distance as the fuzziness metric.
|
// distance as the fuzziness metric.
|
||||||
func NewFuzzyQuery(term string) *fuzzyQuery {
|
func NewFuzzyQuery(term string) *fuzzyQuery {
|
||||||
return &fuzzyQuery{
|
return &fuzzyQuery{
|
||||||
|
|
|
@ -51,7 +51,7 @@ OUTER:
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we still have more characters available to us
|
// if we still have more characters available to us
|
||||||
// push back towards begining
|
// push back towards beginning
|
||||||
// without cross maxbegin
|
// without cross maxbegin
|
||||||
for start > 0 && used < s.fragmentSize {
|
for start > 0 && used < s.fragmentSize {
|
||||||
r, size := utf8.DecodeLastRune(orig[0:start])
|
r, size := utf8.DecodeLastRune(orig[0:start])
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (t TermLocations) Less(i, j int) bool {
|
||||||
}
|
}
|
||||||
// all the common array positions are the same
|
// all the common array positions are the same
|
||||||
if len(t[i].ArrayPositions) < len(t[j].ArrayPositions) {
|
if len(t[i].ArrayPositions) < len(t[j].ArrayPositions) {
|
||||||
return true // j array positions, longer so greather
|
return true // j array positions, longer so greater
|
||||||
} else if len(t[i].ArrayPositions) > len(t[j].ArrayPositions) {
|
} else if len(t[i].ArrayPositions) > len(t[j].ArrayPositions) {
|
||||||
return false // j array positions, shorter so less
|
return false // j array positions, shorter so less
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ func LevenshteinDistanceMax(a, b *string, max int) (int, bool) {
|
||||||
|
|
||||||
lastdiag = olddiag
|
lastdiag = olddiag
|
||||||
}
|
}
|
||||||
// after each row if rowmin isnt less than max stop
|
// after each row if rowmin isn't less than max stop
|
||||||
if rowmin > max {
|
if rowmin > max {
|
||||||
return max, true
|
return max, true
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ func incrementBytes(in []byte) []byte {
|
||||||
for i := len(rv) - 1; i >= 0; i-- {
|
for i := len(rv) - 1; i >= 0; i-- {
|
||||||
rv[i] = rv[i] + 1
|
rv[i] = rv[i] + 1
|
||||||
if rv[i] != 0 {
|
if rv[i] != 0 {
|
||||||
// didnt' overflow, so stop
|
// didn't overflow, so stop
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user