From f2b6c143f091167d264f72c2be4e3ab4c11d7f97 Mon Sep 17 00:00:00 2001 From: Martii Date: Tue, 4 Mar 2025 12:44:52 -0500 Subject: [PATCH 1/2] Revert "Create pattern blob for indexing (#2060)" 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 }); From 46e48698fbea9199cebfeeb1c4c7fe58a74e299c Mon Sep 17 00:00:00 2001 From: Martii Date: Tue, 4 Mar 2025 13:05:33 -0500 Subject: [PATCH 2/2] Abstract poolSize * Since we've been running our own DB server we have way more connections... utilize them. * Re-Rearrange indexing to closely match query order and style conformance with spacing Post #2048 NOTE: There's more to do... --- app.js | 2 +- libs/modelQuery.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 28f5d9f6c..a544f1c08 100755 --- a/app.js +++ b/app.js @@ -73,7 +73,7 @@ var _ = require('underscore'); var findSessionData = require('./libs/modifySessions').findSessionData; var dbOptions = {}; -var defaultPoolSize = 10; +var defaultPoolSize = ensureIntegerOrNull(process.env.CONNECT_POOL_SIZE) || 100; // Current *mongoose* default if (isPro) { dbOptions = { poolSize: defaultPoolSize, diff --git a/libs/modelQuery.js b/libs/modelQuery.js index 1633a5193..a93558fd4 100644 --- a/libs/modelQuery.js +++ b/libs/modelQuery.js @@ -125,7 +125,7 @@ var parseScriptSearchQuery = function (aScriptListQuery, aQuery, aLimited) { }); } else { parseModelListSearchQuery(aScriptListQuery, aQuery, { - partialWordMatchFields: ['name', '_description', 'author', '_about' ], + partialWordMatchFields: ['name', 'author', '_description', '_about'], fullWordMatchFields: ['meta.UserScript.include.value', 'meta.UserScript.match.value'] }); }