在marklogic的搜索结果中增加日期

时间:2018-10-05 17:40:14

标签: marklogic marklogic-8 marklogic-9

我想增强查询以在首页上获得与发布内容的最新发布日期有关的搜索结果。

是否需要传递任何参数以获取所需的结果。

OR

我需要创建任何单独的查询来执行相同的操作。

任何对此的想法或建议,将不胜感激。

1 个答案:

答案 0 :(得分:4)

您要在该日期添加范围查询。要使离今天更近的日期得分更高,请使查询为日期<=今天的日期,并使用> internal-api@1.0.0 test /Users/./Projects/./node/internal-api > grunt test Running "test" task Running "env:dev" (env) task Running "simplemocha:unit" (simplemocha) task (node:72101) UnhandledPromiseRejectionWarning: Error at Object.<anonymous> (/Users/./Projects/./node/internal-api/src/test/unit/models/mvp.test.ts:21:57) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (/Users/./Projects/./node/internal-api/node_modules/coffee-script/lib/coffee-script/register.js:45:36) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at /Users/./Projects/./node/internal-api/node_modules/mocha/lib/mocha.js:222:27 at Array.forEach (<anonymous>) at Mocha.loadFiles (/Users/./Projects/./node/internal-api/node_modules/mocha/lib/mocha.js:219:14) at Mocha.run (/Users/./Projects/./node/internal-api/node_modules/mocha/lib/mocha.js:487:10) at Object.<anonymous> (/Users/./Projects/./node/internal-api/node_modules/grunt-simple-mocha/tasks/simple-mocha.js:29:20) at Object.<anonymous> (/Users/./Projects/./node/internal-api/node_modules/grunt/lib/grunt/task.js:255:15) at Object.thisTask.fn (/Users/./Projects/./node/internal-api/node_modules/grunt/lib/grunt/task.js:73:16) at Object.<anonymous> (/Users/./Projects/./node/internal-api/node_modules/grunt/lib/util/task.js:294:30) at Task.runTaskFn (/Users/./Projects/./node/internal-api/node_modules/grunt/lib/util/task.js:244:24) at Task.<anonymous> (/Users/./Projects/./node/internal-api/node_modules/grunt/lib/util/task.js:293:12) at /Users/./Projects/./node/internal-api/node_modules/grunt/lib/util/task.js:220:11 at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:695:11) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3 (node:72101) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:72101) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. successApiClient ✓ does not have a warning failApiClient ✓ should not have a warning (node:72101) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) explicitFailApiClient ✓ does not have a warning 3 passing (14ms) Done. 。您可能还需要调整slope-factor option以获得所需的效果。

有关更多信息,请参见the Search Developer's Guide,尤其是“ Including a Range or Geospatial Query in Scoring”部分。