new to MarkLogic and I'm having some trouble using the /suggest endpoint of the MarkLogic REST API.
I am trying to generate suggestions based on the 'name' attribute from all documents in my test database.
The documents look like this: app-prototype (3 Documents) | /gs/cobra.json
{
"name": "cobra",
"kind": "mammal",
"desc": "The cobra is a venomous, hooded snake of the family Elapidae."
}
Calling http://host:port/v1/suggest?partial-q=c, is always returning an empty set, and I suspect it's an issue with my search options/configuration.
Response:
{
"suggestions": []
}
Using the following suggest-options.xml:
<options xmlns="http://marklogic.com/appservices/search">
<default-suggestion-source>
<range type="xs:string">
<element ns="" name="name"/>
<attribute ns="" name="name"/>
</range>
</default-suggestion-source>
</options>
and the following Attribute Range Index Configuration: Attribute Range Index
Unsure if I'm misunderstanding the use of namespaces/range indexes here.
Could anyone shed some light on what could be going wrong here?
EDIT: Replaced the index with an Element Range Index as follows: Element Range Index
and updated the default-suggestion-source to:
<options xmlns="http://marklogic.com/appservices/search">
<default-suggestion-source>
<range type="xs:string">
<element ns="http://marklogic.com/xdmp/dls" name="name"/>
<attribute ns="http://marklogic.com/xdmp/dls" name="name"/>
</range>
</default-suggestion-source>
</options>
Still no results returning.