mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-20 12:46:17 +08:00
feat(search): enhanced meilisearch
search experience (#864)
* feat(search): enhanced `meilisearch` search experience - upgrade `meilisearch` dependency - support subdirectory search - optimize searchDocument fields for subdirectory search - specify full index uid instead of index prefix * fix(search): more fixes to `meilisearch` - make use of context where context was not used - remove code of waiting task in deletion process, as tasks are queued and will be executed orderly (if tasks were submitted to the queue successfully), which can improve `AutoUpdate` performance
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package utils
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEncodePath(t *testing.T) {
|
||||
t.Log(EncodePath("http://localhost:5244/d/123#.png"))
|
||||
@ -20,3 +23,31 @@ func TestFixAndCleanPath(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPathHierarchy(t *testing.T) {
|
||||
testCases := map[string][]string{
|
||||
"": {"/"},
|
||||
"/": {"/"},
|
||||
"/home": {"/", "/home"},
|
||||
"/home/user": {"/", "/home", "/home/user"},
|
||||
"/home/user/documents": {"/", "/home", "/home/user", "/home/user/documents"},
|
||||
"/home/user/documents/files/test.txt": {"/", "/home", "/home/user", "/home/user/documents", "/home/user/documents/files", "/home/user/documents/files/test.txt"},
|
||||
"home": {"/", "/home"},
|
||||
"home/user": {"/", "/home", "/home/user"},
|
||||
"./home/": {"/", "/home"},
|
||||
"..//home//user/../././": {"/", "/home"},
|
||||
"/home///user///documents///": {"/", "/home", "/home/user", "/home/user/documents"},
|
||||
"/home/user with spaces/doc": {"/", "/home", "/home/user with spaces", "/home/user with spaces/doc"},
|
||||
"/home/user@domain.com/files": {"/", "/home", "/home/user@domain.com", "/home/user@domain.com/files"},
|
||||
"/home/.hidden/.config": {"/", "/home", "/home/.hidden", "/home/.hidden/.config"},
|
||||
}
|
||||
|
||||
for input, expected := range testCases {
|
||||
t.Run(input, func(t *testing.T) {
|
||||
result := GetPathHierarchy(input)
|
||||
if !reflect.DeepEqual(result, expected) {
|
||||
t.Errorf("GetPathHierarchy(%q) = %v, want %v", input, result, expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user