Spaces:
Running
Running
Sync from felladrin/MiniSearch@bcf089f (part 2)
Browse filesFiles changed (4)
248 unmodified lines249250251252253254255248 unmodified lines| `averageGraphicalSearchesPerSession` | number | Image searches / sessions ratio || `searchesWithoutResults` | number | Searches, text and image together, that SearXNG answered with zero results and no unresponsive engines || `searchesWithUnresponsiveEngines` | number | Searches, text and image together, that came back with zero results and unresponsive engines, whether the retries were spent or an all-suspended set failed fast; one per search, not per attempt || `searchesWithAllResultsDiscarded` | number | Text searches whose results were all dropped during processing || `searchesServedByFallback` | number | Text searches answered by the fallback source after SearXNG failed || `searchesFailedOnFallback` | number | Fallback searches that failed, plus searches where SearXNG's own retries had left too little of the search deadline for the fallback to be asked at all. A rising count is therefore not by itself a sign that the fallback providers are failing || `biEncoderServiceStatus` | string | `"healthy"` or `"unhealthy"` |248 unmodified lines249250251252253254255248 unmodified lines| `averageGraphicalSearchesPerSession` | number | Image searches / sessions ratio || `searchesWithoutResults` | number | Searches, text and image together, that SearXNG answered with zero results and no unresponsive engines || `searchesWithUnresponsiveEngines` | number | Searches, text and image together, that came back with zero results and unresponsive engines, whether the retries were spent or an all-suspended set failed fast; one per search, not per attempt || `searchesWithAllResultsDiscarded` | number | Searches, text and image together, whose results were all dropped during processing (for images, none had a thumbnail) || `searchesServedByFallback` | number | Text searches answered by the fallback source after SearXNG failed || `searchesFailedOnFallback` | number | Fallback searches that failed, plus searches where SearXNG's own retries had left too little of the search deadline for the fallback to be asked at all. A rising count is therefore not by itself a sign that the fallback providers are failing || `biEncoderServiceStatus` | string | `"healthy"` or `"unhealthy"` |
260 unmodified lines2612622632642652662672682697 unmodified lines2772782792802812822832842852862872882892902912922932942952962972988 unmodified lines3073083093103113123133143158 unmodified lines3243253263273283293303313328 unmodified lines3413423433443453463473483498 unmodified lines35835936036136236336436536611 unmodified lines37837938038138238338438538611 unmodified lines39839940040140240340440540611 unmodified lines41841942042142242342442542611 unmodified lines4384394404414424434444454468 unmodified lines455456457458459460461462463260 unmodified lines}},"node_modules/@biomejs/biome": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.8.tgz","integrity": "sha512-kqZUFvX6/aYQOmzfRN5ANcfNS9wLH4aHLWWP/dQKyhRZVoA6rdWszA7DGugFcxPbMiznUyVYyukVl+ExZN4PQA==","dev": true,"license": "MIT OR Apache-2.0","bin": {7 unmodified lines"url": "https://opencollective.com/biome"},"optionalDependencies": {"@biomejs/cli-android-arm64": "2.6.8","@biomejs/cli-android-x64": "2.6.8","@biomejs/cli-darwin-arm64": "2.6.8","@biomejs/cli-darwin-x64": "2.6.8","@biomejs/cli-linux-arm64": "2.6.8","@biomejs/cli-linux-arm64-musl": "2.6.8","@biomejs/cli-linux-x64": "2.6.8","@biomejs/cli-linux-x64-musl": "2.6.8","@biomejs/cli-win32-arm64": "2.6.8","@biomejs/cli-win32-x64": "2.6.8"}},"node_modules/@biomejs/cli-android-arm64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.8.tgz","integrity": "sha512-X4JKPLK85kfUTwuuaORFplnBfGjKkp62PsFhhcL7F/Tpltc7pyUofjlkkMnlZZLWsifFl7LNB8ngVrwJg1uo1Q==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-android-x64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.8.tgz","integrity": "sha512-C3Hk485vl+deEj53K08+SYYelPIPkdSZL3qHuD31Xi+qydVa4q2ze+aCYo1k3iJGWtvWtjHaGkDh7S2sX6wk8w==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-arm64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.8.tgz","integrity": "sha512-DHyj+JnRHcn4YdvpiqgTFZMYKSPELMCfFpNNlEuu1L8DKTGXhzW7raIwdsbo2Ie9nCljQLAQkVWQk/mwM0ueiA==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-x64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.8.tgz","integrity": "sha512-QWWUPjlA0RnkkgYnFLUHZu+RrDc0FdK0A+wEPA+dENQJwsuSHMH89lspnAw2QUWWc9VHyfluGx1Xmp6Y2GZi8Q==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.8.tgz","integrity": "sha512-0Bjim8lKwnrvXUHoI4k3Tb51BjoiLEwDnovCI8nSzkk6wj3dShiuAjrx6+X0Hjf4ejR1sRZgTQiSDHlpy9vB7w==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64-musl": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.8.tgz","integrity": "sha512-WB9PhOitX+bRc0G3+GNJGlvbKoWn3JoB9z4E04JQizIC9aPCQyIvwvWG7QZHxw6k20Fi+dHLmZ2fSEmBa9HqiA==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.8.tgz","integrity": "sha512-XIk3pLQT56I6Tti+u0DF8FtSNXjCMTPbxVTzfJ9cS2t1ImVKvrqV5b52GuEaJg6/wuiXvz0sjfb5saB4TPRjzA==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64-musl": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.8.tgz","integrity": "sha512-64Yzo+J4fEk7Kf9SMnVdVxC+Y2A2e/L86QTP9JjGQ57lsddyELLpbBcNMxSJggre2T1AvISwwSrOApkBAHDqNA==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-win32-arm64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.8.tgz","integrity": "sha512-ezjCEZzHIWE2pdh83a7zLVcAAcDaERcTcvfA7uWlxqz/1CuDxgtfO19pDg9B6YY4wKYIDvYBw2QCMnqIshSwmw==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-win32-x64": {"version": "2.6.8","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.8.tgz","integrity": "sha512-cD6HvGczZUiAYsY8s2TxxXj2AHFzEdMomvVJfEjzOjBM45nGqIDfBpbtvwGQzDCN8X2yKKk9u1jnDZisT2nxIg==","cpu": ["x64"],260 unmodified lines2612622632642652662672682697 unmodified lines2772782792802812822832842852862872882892902912922932942952962972988 unmodified lines3073083093103113123133143158 unmodified lines3243253263273283293303313328 unmodified lines3413423433443453463473483498 unmodified lines35835936036136236336436536611 unmodified lines37837938038138238338438538611 unmodified lines39839940040140240340440540611 unmodified lines41841942042142242342442542611 unmodified lines4384394404414424434444454468 unmodified lines455456457458459460461462463260 unmodified lines}},"node_modules/@biomejs/biome": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.9.tgz","integrity": "sha512-RelCBDzTXu4DBU8c35P4iMrDO80SUjW0OgjDA7CT1z3UcCU5IclWTZ2XnMelI4frQL//xg2K2BQxAhcOKxdPQA==","dev": true,"license": "MIT OR Apache-2.0","bin": {7 unmodified lines"url": "https://opencollective.com/biome"},"optionalDependencies": {"@biomejs/cli-android-arm64": "2.6.9","@biomejs/cli-android-x64": "2.6.9","@biomejs/cli-darwin-arm64": "2.6.9","@biomejs/cli-darwin-x64": "2.6.9","@biomejs/cli-linux-arm64": "2.6.9","@biomejs/cli-linux-arm64-musl": "2.6.9","@biomejs/cli-linux-x64": "2.6.9","@biomejs/cli-linux-x64-musl": "2.6.9","@biomejs/cli-win32-arm64": "2.6.9","@biomejs/cli-win32-x64": "2.6.9"}},"node_modules/@biomejs/cli-android-arm64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.9.tgz","integrity": "sha512-/3Aj5aiG+Iz8yDBJJb/GFDsptr9ONk3n1wZUIERuU+pVXMIslBaOnrTYJI5QVVXZ9jE494myQHiIvFrjQCBYeQ==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-android-x64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.9.tgz","integrity": "sha512-erjbUpD9KJhzTsGHY9oStJ1bSiUJ1ikUXgdr0iOFoIAMiKqW+GdVdEqAlEyqiZA6CBiFqf2fV+g0AVl3hYOuYg==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-arm64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.9.tgz","integrity": "sha512-fO67s0SF+lKGhNPQ7jUXiz0yXGl/1Qm3XTIn/4Hd2Z2z3ewQMrotWIMVdIPxZAgLJdQtRLBOzgsTRzTl981yWA==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-x64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.9.tgz","integrity": "sha512-RdjT3Z6dLlii0x6EroncTp9jg38FMx2R1aeaaU4BbZ4//3TJ2mA2R39KMIrZYxHdHXcfv9X2V5hwKkXhg08w/g==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.9.tgz","integrity": "sha512-x73OpQSuQLuvNfzXWEjf0mK95NxlJQX4eG/jmuSrGWOz+/jcLUE4N/21yBu3n0X+wa8bJ3NsWNvmNacLnyc2CQ==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64-musl": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.9.tgz","integrity": "sha512-qoG0R5MhJ8VFozVFZQC42V3qCI1TInDhL/YcPPg0oTzfv3vuh0ZDXj+2nNahq8gboHUMv7MWpGjRDLhpQatJ+A==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.9.tgz","integrity": "sha512-uVrqS0HDjRzFlx88ZpfmlZvJ+xIwTU+110vunzrYvZQ5OqXl/1ugMTNvAs61hejH7jh7iequKJwagRVarrYcSQ==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64-musl": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.9.tgz","integrity": "sha512-o73Sk1hCbGOFOrDlxtpHGIubnLwMXscT32+ujMwUyq9o0f4onxO7OznzkFgcZGbwKy1R3ohroOkqZDXqj1u29g==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-win32-arm64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.9.tgz","integrity": "sha512-4yvNG4nQGJsJA/PTVAt8IBFXvY6hXk4UdjtPlTf4QTMIjH7ysOwBew78bKThkRv1eyRwH2mGLIk4lAZp8tfAdw==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-win32-x64": {"version": "2.6.9","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.9.tgz","integrity": "sha512-mwarNc4GEg5JknsRaJDyJDFr4kICD7snsGM8yYFOoIHimSU1ekWNbcZ44QDa6/30fUZC9077wbBpXE8fp03aug==","cpu": ["x64"],
614 unmodified lines615616617618619620614 unmodified lines],]);});});describe("query privacy", () => {614 unmodified lines615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671614 unmodified lines],]);});it("fills the limit with images that have a thumbnail, skipping those without", async () => {const withoutThumbnail = Array.from({ length: 5 }, (_, index) =>index < 2? {title: `video ${index} without thumbnail`,url: `https://example.com/watch-${index}`,category: "videos",iframe_src: `https://example.com/embed-${index}`,}: {title: `image ${index} without thumbnail`,url: `https://example.com/blank-${index}`,category: "images",img_src: `https://example.com/blank-${index}.jpg`,thumbnail_src: "",},);const withThumbnail = Array.from({ length: 7 }, (_, index) => ({title: `image ${index}`,url: `https://example.com/picture-${index}`,category: "images",img_src: `https://example.com/picture-${index}.jpg`,thumbnail_src: `https://example.com/thumbnail-${index}.jpg`,}));fetchMock.mockResolvedValue(createMockResponse(JSON.stringify({ results: [...withoutThumbnail, ...withThumbnail] }),),);const results = await fetchSearXNG("failure injection","images",5,new CircuitBreaker(breakerOptions),);// A limit applied before the filter would return nothing, and none at all// would return all seven.expect(results).toEqual(withThumbnail.slice(0, 5).map(({ title, url, thumbnail_src, img_src }) => [title,url,thumbnail_src,img_src,]),);});});describe("query privacy", () => {
340 unmodified lines3413423433443453463473483494 unmodified lines354355356357358359360361362363364365340 unmodified linesconst results = await breaker.execute("searxng", () =>performSearch(query, searchType, signal),);const consideredResults = openableUniqueResults(results).slice(0, limit);if (searchType === "text") {const textualResults = await Promise.all(consideredResults.map(processTextualResult),);4 unmodified lines);}const graphicalResults = await Promise.all(consideredResults.map(processGraphicalResult),);return reportDiscardedResults(filterNullResults(graphicalResults),consideredResults.length,searchType,);}340 unmodified lines3413423433443453463473483493504 unmodified lines355356357358359360361362363364365366367368340 unmodified linesconst results = await breaker.execute("searxng", () =>performSearch(query, searchType, signal),);const openableResults = openableUniqueResults(results);if (searchType === "text") {const consideredResults = openableResults.slice(0, limit);const textualResults = await Promise.all(consideredResults.map(processTextualResult),);4 unmodified lines);}// Dropped before the limit applies, so images without a thumbnail at the top// of the response cannot take the slots of usable ones further down.const graphicalResults = await Promise.all(openableResults.map(processGraphicalResult),);return reportDiscardedResults(filterNullResults(graphicalResults).slice(0, limit),openableResults.length,searchType,);}
docs/overview.md+1-1
package-lock.json+43-43
server/webSearchService.test.ts+51
server/webSearchService.ts+7-4