问题
So this one is really weird. I have a completly empty database and use the following code:
xquery version "1.0-ml";
import module namespace search = "http://marklogic.com/appservices/search"
at "/MarkLogic/appservices/search/search.xqy";
search:suggest("qwe" ,
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="qweqwe">
<word type="xs:string" collation="http://marklogic.com/collation/">
<element name="test"/>
</word>
</constraint>
<default-suggestion-source ref="qweqwe"/>
</options>
)
The result of this is one suggestions: qweqwe:
The search:suggest
seems to find the constraint name and suggest it.
Steps to reproduce:
- clear database
- create element word lexicons for element
test
with collationhttp://marklogic.com/collation/
- execute previous code
Using ml 9.0-8 with a completly empty and reindexed documents
database. You can change the name of the constraint to whatever you want, you can always get a suggestion for it. Is this a bug?
回答1:
Not a bug, it is by design. search:suggest, and /v1/suggest are most commonly used for typeahead suggestions in a search bar. It is a user-convenience kind of thing. It helps the user discover the available constraints, giving them back including a colon, so you can continue looking for values for that constraint, after inserting the name+colon.
HTH!
来源:https://stackoverflow.com/questions/54162942/marklogic-searchsuggest-finds-constraint-name