@xuda.io/drive_module 1.1.853 → 1.1.855
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 +36 -34
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1725,44 +1725,46 @@ exports.search_drive_files = async function (req) {
|
|
|
1725
1725
|
|
|
1726
1726
|
if (protected_tags.includes(search_string)) {
|
|
1727
1727
|
// var og_search = ""
|
|
1728
|
-
let tags_query = search_string
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
if(tagKey
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1728
|
+
let tags_query = search_string
|
|
1729
|
+
.split(" ")
|
|
1730
|
+
.filter((e) => e.includes(":"))
|
|
1731
|
+
.reduce((ret, val) => {
|
|
1732
|
+
var tagKey = val.split(":")[0];
|
|
1733
|
+
var tagVal = val.split(":")[1];
|
|
1734
|
+
|
|
1735
|
+
if (!ret[tagKey]) ret[tagKey] = [];
|
|
1736
|
+
|
|
1737
|
+
if (tagVal) {
|
|
1738
|
+
if (tagKey === "tags") {
|
|
1739
|
+
ret[tagKey].push({ tags: { $in: tagVal } });
|
|
1740
|
+
} else {
|
|
1741
|
+
ret[tagKey].push({ $or: { $regex: tagVal } });
|
|
1742
|
+
}
|
|
1743
|
+
} else {
|
|
1744
|
+
og_search += og_search;
|
|
1741
1745
|
}
|
|
1742
|
-
} else {
|
|
1743
|
-
og_search += og_search;
|
|
1744
|
-
}
|
|
1745
1746
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1747
|
+
return ret;
|
|
1748
|
+
}, {});
|
|
1749
|
+
|
|
1750
|
+
var new_search = search_string
|
|
1751
|
+
.split(" ")
|
|
1752
|
+
.filter((e) => !e.includes(":"))
|
|
1753
|
+
.filter((e) => e)
|
|
1754
|
+
.join(" ");
|
|
1755
|
+
|
|
1756
|
+
tags_query.$or = [
|
|
1757
|
+
{
|
|
1758
|
+
ocr: {
|
|
1759
|
+
$regex: `(?i)${new_search}`,
|
|
1760
|
+
},
|
|
1755
1761
|
},
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1762
|
+
{
|
|
1763
|
+
originalname: {
|
|
1764
|
+
$regex: `(?i)${new_search}`,
|
|
1765
|
+
},
|
|
1760
1766
|
},
|
|
1761
|
-
|
|
1762
|
-
],
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1767
|
+
];
|
|
1766
1768
|
}
|
|
1767
1769
|
try {
|
|
1768
1770
|
validate_drive_type(drive_type);
|