Hi All,

I am using cts:element-values() to return suggestions based on the input
char/string and its other matches and I want the result in order of input.
If I entered A, the match of A should come first and then matches of others.

Please help me to correct my code!

Query-
---
let $query := cts:or-query(cts:element-range-query(xs:QName("sum:TS"), "=",
("A", "AB", "AC","ABDC","AXYZ"), ("collation=
http://marklogic.com/collation/codepoint";), 1), ())
let $values :=
cts:element-values(xs:QName('Searchable-Value'),(),(fn:concat("limit=", 10)
,"fragment-frequency","item-order", "concurrent"), $query)
return $values

The cts:element-values() is not returning results in the order of inputs
("A", "AB", "AC","ABDC","AXYZ").

Might be in this example the output same however when ("A", "AB",
"AC","ABDC","AXYZ", ....) increase then the order of results unexpected.

Is there any way to show the results in order of input ("A", "AB",
"AC","ABDC","AXYZ"....)?


XML document 1
<?xml version="1.0" encoding="UTF-8"?>
<Company>
    <Company-Name>NOBLE CORP SWITZERLAND</Company-Name>
    <Searchable-Value>{"CompanyName":"NOBLE CORP
SWITZERLAND","TS":"AC"}</Searchable-Value>
</Company>
XML document 2
<?xml version="1.0" encoding="UTF-8"?>
<Company>
    <Company-Name>SAFEGUARD SCIENTIFICS INC</Company-Name>
    <Searchable-Value>{"CompanyName":"SAFEGUARD SCIENTIFICS
INC","CIK":"86115","TS":"A"}</Searchable-Value>
</Company>
XML document 3
<?xml version="1.0" encoding="UTF-8"?>
<Company>
    <Company-Name>CRUCELL NV</Company-Name>
    <Searchable-Value>{"CompanyName":"CRUCELL
NV","CIK":"1126136","TS":"AB"}</Searchable-Value>
</Company>
.........
............



Expected output:
------------

<Searchable-Value>{"CompanyName":"SAFEGUARD SCIENTIFICS
INC","CIK":"86115","TS":"A"}</Searchable-Value>
<Searchable-Value>{"CompanyName":"CRUCELL
NV","CIK":"1126136","TS":"AB"}</Searchable-Value>
<Searchable-Value>{"CompanyName":"NOBLE CORP
SWITZERLAND","TS":"AC"}</Searchable-Value>


Regards,
Indy
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to