Skip to content

Commit 1fa2660

Browse files
committed
refactor:Finalized changes to info that is displayed
1 parent 3273b24 commit 1fa2660

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

core/database/foxx/api/tag_router.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = router;
1717
router
1818
.post("/search", function (req, res) {
1919
let client = null;
20+
let cnt = null;
2021
try {
2122
client = req.queryParams.client
2223
? g_lib.getUserFromClientID(req.queryParams.client)
@@ -33,9 +34,9 @@ router
3334
if (name.length < 3)
3435
throw [error.ERR_INVALID_PARAM, "Input is too short for tag search."];
3536

36-
var off = req.queryParams.offset ? req.queryParams.offset : 0,
37-
cnt = req.queryParams.count ? req.queryParams.count : 50,
38-
result = g_db._query(
37+
var off = req.queryParams.offset ? req.queryParams.offset : 0;
38+
cnt = req.queryParams.count ? req.queryParams.count : 50;
39+
var result = g_db._query(
3940
"for t in tagview search analyzer(t._key in tokens(@name,'tag_name'), 'tag_name') let s = BM25(t) sort s desc limit @off,@cnt return {name: t._key, count: t.count}",
4041
{
4142
name: name,
@@ -64,8 +65,12 @@ router
6465
httpVerb: "POST",
6566
routePath: basePath + "/search",
6667
status: "Success",
67-
description: "Search for tags by name",
68-
extra: result,
68+
description: `Search for tags by name(${req.queryParams?.name?.trim()})`,
69+
extra:
70+
{
71+
requestedName: name,
72+
returnedCount: result.length - 1, // subtract the paging object
73+
}
6974
});
7075
} catch (e) {
7176
logger.logRequestFailure({
@@ -74,8 +79,12 @@ router
7479
httpVerb: "POST",
7580
routePath: basePath + "/search",
7681
status: "Failure",
77-
description: "Search for tags by name",
78-
extra: result,
82+
description: `Search for tags by name(${req.queryParams?.name?.trim()})`,
83+
extra:
84+
{
85+
requestedName: name,
86+
returnedCount: result.length - 1, // subtract the paging object
87+
},
7988
error: e,
8089
});
8190
g_lib.handleException(e, res);

0 commit comments

Comments
 (0)