@xuda.io/drive_module 1.1.852 → 1.1.854
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 -29
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1725,38 +1725,45 @@ 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
|
-
ret[tagKey]
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
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;
|
|
1745
|
+
}
|
|
1743
1746
|
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
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
|
+
tags_query.$or = [
|
|
1756
|
+
{
|
|
1757
|
+
ocr: {
|
|
1758
|
+
$regex: `(?i)${new_search}`,
|
|
1759
|
+
},
|
|
1749
1760
|
},
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1761
|
+
{
|
|
1762
|
+
originalname: {
|
|
1763
|
+
$regex: `(?i)${new_search}`,
|
|
1764
|
+
},
|
|
1754
1765
|
},
|
|
1755
|
-
|
|
1756
|
-
],
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1766
|
+
];
|
|
1760
1767
|
}
|
|
1761
1768
|
try {
|
|
1762
1769
|
validate_drive_type(drive_type);
|