Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22604

MarkLogic - search.suggest does not return any values

$
0
0

I'm trying to use search.suggest to return me some suggestions based on a multiple range indexes in my database. So far I've tried with single string element range index, but can't figure out proper syntax I guess.

const search = require('/MarkLogic/appservices/search/search');const options = fn.head(xdmp.unquote('<search:options xmlns:search="http://marklogic.com/appservices/search">'+'<default-suggestion-source>'+'<range collation="http://marklogic.com/collation//S1" type="xs:string">'+'<json-property>title</json-property>'+'</range>'+'</default-suggestion-source>'+'</search:options>')).root;search.suggest("Taiw", options)

I've changed a bit a code snippet from here: https://docs.marklogic.com/10.0/search.suggest but it does not produce any results:enter image description here

I have element range index in my database with dataenter image description hereenter image description here

I've also tried to use JSON:

const search = require('/MarkLogic/appservices/search/search');const options = {"search:options":{"default-suggestion-source":{"range":{"range":{"type":"xs:string","collation":"http://marklogic.com/collation//S1","element":{"name":"title"            }         }      }   }}}search.suggest("Taiw", options)

But I end up with:

[javascript] XDMP-AS: (err:XPTY0004) $options aselement(search:options)? -- Invalid coercion:object-node{"search:options":object-node{"default-suggestion-source":object-node{...}}}as element(search:options)

What am I doing wrong? Is there any setting I need to set on my database". I'm using JSON data


Viewing all articles
Browse latest Browse all 22604

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>