From 4f41abd8152ca88e3f4efe5bf30467ff29ecf898 Mon Sep 17 00:00:00 2001 From: Marti Martz Date: Tue, 4 Mar 2025 10:49:29 -0700 Subject: [PATCH] Revert "Create pattern blob for indexing (#2060)" (#2061) This reverts commit 4463468f0462b0622bf0cdd2483e7c41537bbde0. Not the issue... reversion of #2060 and post #2048 --- controllers/scriptStorage.js | 13 ------------- libs/modelQuery.js | 4 ++-- models/script.js | 2 -- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/controllers/scriptStorage.js b/controllers/scriptStorage.js index ba44c3111..99a38ceb8 100644 --- a/controllers/scriptStorage.js +++ b/controllers/scriptStorage.js @@ -2062,8 +2062,6 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) { var now = null; var storeDescriptionLength = null; - var includes = null; - var matches = null; if (aRemoved) { aCallback(new statusError({ @@ -2087,8 +2085,6 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) { // New script now = new Date(); - includes = findMeta(aMeta, 'UserScript.include.value'); - matches = findMeta(aMeta, 'UserScript.match.value'); storeDescriptionLength = settings.scriptSearchQueryStoreMaxDescription; storeDescriptionLength = rLogographic.test(thisDescription) @@ -2115,8 +2111,6 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) { installName: installName, fork: null, meta: aMeta, - _pattern: ((includes ? includes.join(' ') : '') + ' ' - + (matches ? matches.join(' ') : '')).trim(), isLib: isLib, uses: isLib ? null : libraries, _authorId: aUser._id @@ -2153,13 +2147,6 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) { : '' ); aScript.meta = aMeta; - - includes = findMeta(aMeta, 'UserScript.include.value'); - matches = findMeta(aMeta, 'UserScript.match.value'); - - aScript._pattern = ((includes ? includes.join(' ') : '') + ' ' - + (matches ? matches.join(' ') : '')).trim() - aScript.uses = libraries; // Okay to update diff --git a/libs/modelQuery.js b/libs/modelQuery.js index cd33bfba4..1633a5193 100644 --- a/libs/modelQuery.js +++ b/libs/modelQuery.js @@ -125,8 +125,8 @@ var parseScriptSearchQuery = function (aScriptListQuery, aQuery, aLimited) { }); } else { parseModelListSearchQuery(aScriptListQuery, aQuery, { - partialWordMatchFields: ['name', 'author', '_description', '_about'], - fullWordMatchFields: ['_pattern'] + partialWordMatchFields: ['name', '_description', 'author', '_about' ], + fullWordMatchFields: ['meta.UserScript.include.value', 'meta.UserScript.match.value'] }); } }; diff --git a/models/script.js b/models/script.js index cb7721711..f618dd557 100644 --- a/models/script.js +++ b/models/script.js @@ -15,7 +15,6 @@ var scriptSchema = new Schema({ // Visible name: String, _description: String, - _pattern: String, author: String, installs: { type: Number, default: 0 }, installsSinceUpdate: { type: Number, default: 0 }, @@ -55,7 +54,6 @@ scriptSchema.index({ isLib: 1, name: 1, author: 1, - _pattern: 1, _description: 1, _about: 1 });