mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-05 14:01:43 +02:00
use pb.filter in the search normalization
This commit is contained in:
1 parent
d744647929
commit
82368a6152
7 files changed
+12
-10
No files matched your search
+5
-3
@@ -1118,7 +1118,7 @@ const utils = {
|
||||
return searchTerm;
|
||||
}
|
||||
|
||||
const opChars = ["=", "!=", "~", "!~", ">", ">=", "<", "<="];
|
||||
const opChars = ["=", "~", ">", "<"];
|
||||
|
||||
// loosely check if it is already a filter expression
|
||||
for (const op of opChars) {
|
||||
@@ -1128,10 +1128,12 @@ const utils = {
|
||||
}
|
||||
|
||||
searchTerm = isNaN(searchTerm) && searchTerm != "true" && searchTerm != "false"
|
||||
? `"${searchTerm.replace(/^[\"\'\`]|[\"\'\`]$/gm, "")}"`
|
||||
? searchTerm.replace(/^[\"\'\`]|[\"\'\`]$/gm, "")
|
||||
: searchTerm;
|
||||
|
||||
return fallbackFields.map((f) => `${f}~${searchTerm}`).join("||");
|
||||
return fallbackFields.map((f) => {
|
||||
return app.pb.filter(`${f}?~{:searchTerm}`, { searchTerm });
|
||||
}).join("||");
|
||||
},
|
||||
|
||||
logLevels: {
|
||||
|
||||
Reference in new issue
Block a user