aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/arangodb
diff options
context:
space:
mode:
authorelee <eddy@gfxlabs.io>2022-03-17 05:23:12 -0500
committerelee <eddy@gfxlabs.io>2022-03-17 05:23:12 -0500
commit94883e2fadefae5142bcfa5420e38143d0725ada (patch)
tree03db3a7516c0f83bbbe28cd405b72f881f1a6eac /weed/filer/arangodb
parentf3ab6769e991554969fde3f29fe170a38d34a996 (diff)
downloadseaweedfs-94883e2fadefae5142bcfa5420e38143d0725ada.tar.xz
seaweedfs-94883e2fadefae5142bcfa5420e38143d0725ada.zip
ok then
Diffstat (limited to 'weed/filer/arangodb')
-rw-r--r--weed/filer/arangodb/arangodb_store.go46
1 files changed, 44 insertions, 2 deletions
diff --git a/weed/filer/arangodb/arangodb_store.go b/weed/filer/arangodb/arangodb_store.go
index f10576105..7d47ce2d5 100644
--- a/weed/filer/arangodb/arangodb_store.go
+++ b/weed/filer/arangodb/arangodb_store.go
@@ -107,7 +107,7 @@ func (store *ArangodbStore) connection(uris []string, user string, pass string)
return err
}
- if _, _, err = store.collection.EnsureFullTextIndex(ctx, []string{"directory_fulltext"},
+ if _, _, err = store.collection.EnsureFullTextIndex(ctx, []string{"directory"},
&driver.EnsureFullTextIndexOptions{Name: "IDX_FULLTEXT_directory", MinLength: 1}); err != nil {
return err
}
@@ -263,11 +263,53 @@ remove d in files`, map[string]interface{}{"dir": dir})
return nil
}
-//TODO: use fulltext index
func (store *ArangodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
return lastFileName, filer.ErrUnsupportedListDirectoryPrefixed
}
+//func (store *ArangodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
+// eq := ""
+// if includeStartFile {
+// eq = "filter d.name >= \"" + startFileName + "\""
+// } else {
+// eq = "filter d.name > \"" + startFileName + "\""
+// }
+// query := fmt.Sprintf(`
+//for d in fulltext(files,"directory","prefix:%s")
+//sort d.name desc
+//%s
+//limit %d
+//return d`, string(dirPath), eq, limit)
+// cur, err := store.database.Query(ctx, query, nil)
+// if err != nil {
+// return lastFileName, fmt.Errorf("failed to list directory entries: find error: %w", err)
+// }
+// defer cur.Close()
+// for cur.HasMore() {
+// var data Model
+// _, err = cur.ReadDocument(ctx, &data)
+// if err != nil {
+// break
+// }
+// entry := &filer.Entry{
+// FullPath: util.NewFullPath(data.Directory, data.Name),
+// }
+// lastFileName = data.Name
+// converted := arrayToBytes(data.Meta)
+// if decodeErr := entry.DecodeAttributesAndChunks(util.MaybeDecompressData(converted)); decodeErr != nil {
+// err = decodeErr
+// glog.V(0).Infof("list %s : %v", entry.FullPath, err)
+// break
+// }
+//
+// if !eachEntryFunc(entry) {
+// break
+// }
+//
+// }
+// return lastFileName, err
+//}
+
func (store *ArangodbStore) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
eq := ""
if includeStartFile {