@xuda.io/drive_module 1.1.851 → 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.
Files changed (2) hide show
  1. package/index.js +20 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1721,38 +1721,42 @@ 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
1726
  if (protected_tags.includes(search_string)) {
1727
1727
  // var og_search = ""
1728
- let search_obj = search_string.split(" ").reduce((ret, val) => {
1728
+ let tags_query = search_string.split(" ").filter(e => e.includes(':')).reduce((ret, val) => {
1729
1729
  var tagKey = val.split(":")[0];
1730
1730
  var tagVal = val.split(":")[1];
1731
1731
 
1732
1732
  if (!ret[tagKey]) ret[tagKey] = [];
1733
1733
 
1734
1734
  if (tagVal) {
1735
- ret[tagKey].push({ $or: tagVal });
1735
+ ret[tagKey].push({ $or: {$regex:tagVal} });
1736
1736
  } else {
1737
1737
  og_search += og_search;
1738
1738
  }
1739
1739
 
1740
- // $or: [
1741
- // {
1742
- // ocr: {
1743
- // $regex: `(?i)${req.search_string}`,
1744
- // },
1745
- // },
1746
- // {
1747
- // originalname: {
1748
- // $regex: `(?i)${req.search_string}`,
1749
- // },
1750
- // },
1751
- // ],
1752
- // };
1753
1740
 
1754
1741
  return ret;
1755
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}`,
1749
+ },
1750
+ },
1751
+ {
1752
+ originalname: {
1753
+ $regex: `(?i)${new_search}`,
1754
+ },
1755
+ },
1756
+ ],
1757
+
1758
+
1759
+
1756
1760
  }
1757
1761
  try {
1758
1762
  validate_drive_type(drive_type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.851",
3
+ "version": "1.1.852",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {