@xuda.io/drive_module 1.1.850 → 1.1.852
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 +28 -26
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1721,41 +1721,43 @@ exports.search_drive_files = async function (req) {
|
|
|
1721
1721
|
|
|
1722
1722
|
const sort_by_obj = { name: "originalname", date: "date_created" };
|
|
1723
1723
|
|
|
1724
|
-
const protected_tags=["tag","name"]
|
|
1724
|
+
const protected_tags = ["tag:", "name:"];
|
|
1725
1725
|
|
|
1726
|
-
if(protected_tags.includes(search_string)){
|
|
1726
|
+
if (protected_tags.includes(search_string)) {
|
|
1727
|
+
// var og_search = ""
|
|
1728
|
+
let tags_query = search_string.split(" ").filter(e => e.includes(':')).reduce((ret, val) => {
|
|
1729
|
+
var tagKey = val.split(":")[0];
|
|
1730
|
+
var tagVal = val.split(":")[1];
|
|
1727
1731
|
|
|
1728
|
-
|
|
1729
|
-
let search_obj = search_string.split(" ").reduce((ret, val) => {
|
|
1730
|
-
var tagKey = val.split(":")[0];
|
|
1731
|
-
var tagVal = val.split(":")[1];
|
|
1732
|
+
if (!ret[tagKey]) ret[tagKey] = [];
|
|
1732
1733
|
|
|
1733
|
-
|
|
1734
|
+
if (tagVal) {
|
|
1735
|
+
ret[tagKey].push({ $or: {$regex:tagVal} });
|
|
1736
|
+
} else {
|
|
1737
|
+
og_search += og_search;
|
|
1738
|
+
}
|
|
1734
1739
|
|
|
1735
|
-
if (tagVal) {
|
|
1736
|
-
ret[tagKey].push({ $or: tagVal });
|
|
1737
|
-
} else{
|
|
1738
|
-
og_search += og_search
|
|
1739
|
-
}
|
|
1740
1740
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1741
|
+
return ret;
|
|
1742
|
+
}, {});
|
|
1743
|
+
|
|
1744
|
+
var new_search = search_string.split(" ").filter(e => !e.includes(':')).filter(e=>e).join(' ')
|
|
1745
|
+
tags_query.$or= [
|
|
1746
|
+
{
|
|
1747
|
+
ocr: {
|
|
1748
|
+
$regex: `(?i)${new_search}`,
|
|
1746
1749
|
},
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
originalname: {
|
|
1753
|
+
$regex: `(?i)${new_search}`,
|
|
1751
1754
|
},
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
+
},
|
|
1756
|
+
],
|
|
1757
|
+
|
|
1755
1758
|
|
|
1756
|
-
return ret;
|
|
1757
|
-
}, {});
|
|
1758
1759
|
|
|
1760
|
+
}
|
|
1759
1761
|
try {
|
|
1760
1762
|
validate_drive_type(drive_type);
|
|
1761
1763
|
|