Hi,

 I have following queries regarding search suggestions. I am using version 4.1


1.       In search suggest, using default-suggestion-source ML matches from the 
first word in the string starting from left.

Eg: 'Municipal Finance Authority Act'(DATA)

Search string: m or Municipal (suggestions are coming)

But if search string is : finance(no suggestions come)---- How to achieve this?


            I am using the below options in search suggest:
            let $options :=
<search:options xmlns="http://marklogic.com/appservices/search";>
        <constraint name="CaseName">
        <range collation="http://marklogic.com/collation"; type="xs:string" 
facet="true">
            <element ns="" name="CaseName"/>
        </range>
      </constraint>
    <default-suggestion-source>
         <range collation="http://marklogic.com/collation/";
              type="xs:string" facet="true">
        <element ns="" name="CaseName"/>
        </range>
    </default-suggestion-source>

</search:options>

let $suggestions:= search:suggest(("a"),$options)

Also, I tired creating a custom constraint using parse function but still I am 
not getting any suggestions. PFA files used

Please let me know, if I am missing something.


2.       I get the response as follows:


{"Suggestions":{"suggestion3":"\"Austin v The Commissioner of Police of the 
Metropolis\"", "suggestion2":"\"Austin and another v Metropolitan Police 
Commissioner\"", "suggestion1":"\"AB and others v Ministry of Defence\""}}

But I want to order them as:
suggestion1
suggestion2
suggestion3
or alphabetical order of suggestions.

So what needs to be added below to achieve this:
      let $suggestions := search:suggest(("A"), $options)
let $suggestionsMap := map:map()
let $populateMap :=
             for $suggestion at $index in $suggestions
             return
                  map:put($suggestionsMap, fn:concat("suggestion", $index), 
$suggestion)
             let $json-response := xdmp:to-json($suggestionsMap)
return
            fn:concat('{"Suggestions":', $json-response,"}")

                Or if there is some other way of doing the same .Please provide 
some sample code.


3.       I am unable to use <suggestion-source>option in place of 
</default-suggestion-source>.Could you please let me know exactly how to use 
this. And also how to use multiple <suggestion-source>.One working code will 
help us a lot.

Thanks,
Pragya

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Attachment: suggestion_parse.xqy
Description: suggestion_parse.xqy

Attachment: suggestion source.xqy
Description: suggestion source.xqy

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to