Hello,

It seems to me the simplest and best approach here would be to have one 
suggestion per document rather than multiple suggestions in each document.

Best,
Rob

Rob Szkutak
Senior Consultant
MarkLogic Corporation
[email protected]
www.marklogic.com<http://www.marklogic.com>

________________________________
From: [email protected] 
[[email protected]] on behalf of Jaydip Rananavare 
[[email protected]]
Sent: Friday, May 06, 2016 8:30 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Not able to use indexes in cts:search

Hi All,

We have following document

<SUGGESTIONS>
<SUGGESTION>
<PREF-LABEL>computer</PREF-LABEL>
<ALT-LABEL>laptop</ALT-LABEL>
<HIDDEN-LABEL>super computer</HIDDEN-LABEL>
</SUGGESTION>
<SUGGESTION>
<PREF-LABEL>keyboard</PREF-LABEL>
<ALT-LABEL>virtual keyboard</ALT-LABEL>
<HIDDEN-LABEL>wireless keyboard</HIDDEN-LABEL>
</SUGGESTION>
</SUGGESTIONS>

when user searches for any ALT-LABELS or HIDDEN-LABELS we want to show 
PREF-LABEL as suggestion for that we have used following query

cts:search(//SUGGESTION, cts:path-range-query( 
"/SUGGESTIONS/SUGGESTION/HIDDEN-LABEL", "=" , ("wireless keyboard"), 
("collation=http://marklogic.com/collation/en/S1";)), ("unfiltered"))[1 to 2]

When we pass "filtered" option to cts:search, it works properly with a little 
performance hit, but when we pass "unfiltered" option it does not give correct 
result rather it fetches only first result,
We have also added path range index for above path.(also tried with 
element-value-query)

Any help would be appreciated :)

--

Thanks and regards,

Jaydip Rananavare

M +91 98 60 07 39 90
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to