@xuda.io/drive_module 1.1.886 → 1.1.887
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +46 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -116,6 +116,52 @@ exports.get_drive_files = async function (req) {
|
|
|
116
116
|
opt.selector.file_path = req.path;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
if (search_string) {
|
|
120
|
+
// var og_search = ""
|
|
121
|
+
tags_query = search_string
|
|
122
|
+
.split(" ")
|
|
123
|
+
.filter((e) => e.includes(":"))
|
|
124
|
+
.reduce(
|
|
125
|
+
(ret, val) => {
|
|
126
|
+
var tagKey = val.split(":")[0];
|
|
127
|
+
var tagVal = val.split(":")[1];
|
|
128
|
+
|
|
129
|
+
if (tagKey === "tag") {
|
|
130
|
+
tags.push(tagVal);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (tagKey === "name") {
|
|
134
|
+
ret.$or.push({ originalname: { $regex: `(?i)${tagVal}` } });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return ret;
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
$or: [],
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
var new_search = search_string
|
|
145
|
+
.split(" ")
|
|
146
|
+
.filter((e) => !e.includes(":"))
|
|
147
|
+
.filter((e) => e)
|
|
148
|
+
.join(" ");
|
|
149
|
+
|
|
150
|
+
tags_query.$or = [
|
|
151
|
+
...tags_query.$or,
|
|
152
|
+
{
|
|
153
|
+
ocr: {
|
|
154
|
+
$regex: `(?i)${new_search}`,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
originalname: {
|
|
159
|
+
$regex: `(?i)${new_search}`,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
|
|
119
165
|
validate_drive_type(drive_type);
|
|
120
166
|
|
|
121
167
|
function formatBytes(bytes) {
|