Skip to content

Commit 4cefb0b

Browse files
committed
idNegotiation on search results
1 parent a11c7e6 commit 4cefb0b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

controllers/search.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Basic CRUD operations for RERUM v1
55
* @author Claude Sonnet 4, cubap, thehabes
66
*/
7-
import { newID, isValidID, db } from '../database/index.js'
7+
import { db } from '../database/index.js'
88
import utils from '../utils.js'
9-
import { _contextid, idNegotiation, generateSlugId, ObjectID, createExpressError, getAgentClaim, parseDocumentID } from './utils.js'
9+
import { idNegotiation, createExpressError } from './utils.js'
1010

1111
/**
1212
* Merges and deduplicates results from multiple MongoDB Atlas Search index queries.
@@ -283,8 +283,8 @@ const searchAsWords = async function (req, res, next) {
283283
])
284284

285285
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))
288288
res.set(utils.configureLDHeadersFor(results))
289289
res.json(results)
290290
} catch (error) {
@@ -374,8 +374,8 @@ const searchAsPhrase = async function (req, res, next) {
374374
])
375375

376376
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))
379379
res.set(utils.configureLDHeadersFor(results))
380380
res.json(results)
381381
} catch (error) {

0 commit comments

Comments
 (0)