Hi Rob, Erik,

Thanks for response,

Instead of creating different document for each suggestion we have changed
suggestion tag contents,

<SUGGESTIONS>
<SUGGESTION>computer :: computer </SUGGESTION>
<SUGGESTION>laptop :: computer </SUGGESTION>
<SUGGESTION>super computer :: computer</SUGGESTION>
<SUGGESTION>keyboard :: keyboard </SUGGESTION>
<SUGGESTION>virtual keyboard:: keyboard</SUGGESTION>
<SUGGESTION>wireless keyboard:: keyboard</SUGGESTION>
</SUGGESTIONS>

and we are doing cts:element-value-match on SUGGESTION and showing
substring after :: as suggestion to user.

As we have added range index on suggestion its very fast.



On Fri, May 6, 2016 at 9:09 PM, Erik Hennum <erik.hen...@marklogic.com>
wrote:

> Hi, Jaydip:
>
> To expand on Rob's good suggestion ...
>
> The index always matches a document fragment.
>
> A searchable expression like //SUGGESTION doesn't change that.
>
> The unfiltered search against the index matches document fragments that
> have both a SUGGESTION element and a value of "wireless keyboard" in the
> path range index.
>
> For the matched documents, the searchable expression also extracts the
> SUGGESTION nodes.
>
> Because the search is unfiltered, my understanding is that the extracted
> nodes would not be checked for false positives. The predicate would just
> take the subset of the extracted nodes for the matched documents.
>
> Back to Rob's point -- the standard guidance is to model each document as
> a row, not a table.  That should solve the problem because any SUGGESTION
> document that matches will be a true positive.
>
> By the way, it's a better practice to use fn.subsequence(cts.search(...),
> 1, 2) instead of a [1 to 2] predicate.  fn.subsequence() iterates lazily.
> A predicate is applied to all results (except where optimized away).
>
>
> Hoping that helps,
>
>
> Erik Hennum
>
>
> ------------------------------
> *From:* general-boun...@developer.marklogic.com [
> general-boun...@developer.marklogic.com] on behalf of Rob Szkutak [
> rob.szku...@marklogic.com]
> *Sent:* Friday, May 06, 2016 7:12 AM
> *To:* MarkLogic Developer Discussion
> *Subject:* Re: [MarkLogic Dev General] Not able to use indexes in
> cts:search
>
> 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
> rob.szku...@marklogic.com
> www.marklogic.com
>
> ------------------------------
> *From:* general-boun...@developer.marklogic.com [
> general-boun...@developer.marklogic.com] on behalf of Jaydip Rananavare [
> jaydiprananav...@gmail.com]
> *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
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>


-- 

Thanks and regards,

*Jaydip Rananavare*

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

Reply via email to