|
4 | 4 | * Basic CRUD operations for RERUM v1 |
5 | 5 | * @author Claude Sonnet 4, cubap, thehabes |
6 | 6 | */ |
7 | | -import { newID, isValidID, db } from '../database/index.js' |
| 7 | +import { db } from '../database/index.js' |
8 | 8 | import utils from '../utils.js' |
9 | | -import { _contextid, idNegotiation, generateSlugId, ObjectID, createExpressError, getAgentClaim, parseDocumentID } from './utils.js' |
| 9 | +import { idNegotiation, createExpressError } from './utils.js' |
10 | 10 |
|
11 | 11 | /** |
12 | 12 | * Merges and deduplicates results from multiple MongoDB Atlas Search index queries. |
@@ -283,8 +283,8 @@ const searchAsWords = async function (req, res, next) { |
283 | 283 | ]) |
284 | 284 |
|
285 | 285 | const merged = mergeSearchResults(resultsPresi3, resultsPresi2) |
286 | | - const results = merged.slice(skip, skip + limit) |
287 | | - |
| 286 | + let results = merged.slice(skip, skip + limit) |
| 287 | + results = results.map(o => idNegotiation(o)) |
288 | 288 | res.set(utils.configureLDHeadersFor(results)) |
289 | 289 | res.json(results) |
290 | 290 | } catch (error) { |
@@ -374,8 +374,8 @@ const searchAsPhrase = async function (req, res, next) { |
374 | 374 | ]) |
375 | 375 |
|
376 | 376 | const merged = mergeSearchResults(resultsPresi3, resultsPresi2) |
377 | | - const results = merged.slice(skip, skip + limit) |
378 | | - |
| 377 | + let results = merged.slice(skip, skip + limit) |
| 378 | + results = results.map(o => idNegotiation(o)) |
379 | 379 | res.set(utils.configureLDHeadersFor(results)) |
380 | 380 | res.json(results) |
381 | 381 | } catch (error) { |
|
0 commit comments