Just in case this is an autocomplete: there is a limit option (something
like "limit=5")  that will hasten your query.

Nuno
On Feb 16, 2011 2:53 PM, "Geert Josten" <[email protected]> wrote:
> Hi Mano,
>
> The exception is caused by the large number of User elements. You try to
display them all. Applying pagination will likely help.
>
> If you really are interested in User elements, based on a partial match of
the Surname, you could always add an attribute only containing the first
character of the surname, index that, and use cts:search(//User,
cts:element-attribute-query(…)) to get what you need.
>
> Are you actually trying to support wild-carded searches (difficult with
such helper attributes), or could it be that you are trying to apply some
kind of grouping to the surnames? (should work well this way)
>
> Kind regards,
> Geert
>
> Van: [email protected] [mailto:
[email protected]] Namens Kelly Stirman
> Verzonden: woensdag 16 februari 2011 15:15
> Aan: General MarkLogic Developer Discussion
> Onderwerp: Re: [MarkLogic Dev General] Alternate for wildcard search
>
>
> Hi Mano,
>
> What does your User element look like?
>
> If you want to browse values from documents without pulling the documents
into cache, your only option is to use a range index. It sounds like you
want to display to an end user all the values of User rather than Surname.
Is that correct?
>
> I can think of a few options here:
>
>
> 1) Add an attribute to User that includes “Surname, Firstname” or some
other variation you wish to display, and build a range index on that.
>
> 2) It is possible to build a range index on User, even though it is a
complex node. The values in the range index will be equivalent to
fn:data(User), so you might not have a delimiter in that case that would
give you what you need to display to an end user. You can try it in CQ for a
document to see.
>
> 3) If you have range indexes on Surname and FirstName, you can use
co-occurrences to get the two values together without going to the
documents.
>
> Kelly
> From: [email protected] [mailto:
[email protected]] On Behalf Of mano m
> Sent: Wednesday, February 16, 2011 8:57 AM
> To: General MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Alternate for wildcard search
>
> Hi,
>
> I am getting 2 lakhs result
> <v:results v:warning="non-element item"
xmlns:v="com.marklogic.developer.cq.view">238911</v:results>
>
> Is there anyother way to query the "Surname" element whose value starts
with specific character and return the <Surname> element as output
>
> Regards,
> Mano
>
>
> ________________________________
> From: "Illes, Szabolcs" <[email protected]>
> To: General MarkLogic Developer Discussion <
[email protected]>
> Sent: Wed, 16 February, 2011 7:18:06 PM
> Subject: Re: [MarkLogic Dev General] Alternate for wildcard search
>
> Hi Mano,
>
> cts:element-value-match doesn’t return a cts:query it will only give you
string values from the lexicon, so if you put inside cts:search it willl do
a fulltext search for all the values coming out from the lexicon.
>
> Regarding "XDMP-EXPNTREECACHEFULL"
> How many user do you have in the db?
> Could you do an xdmp:estimate on the range query version and post it here?
>
> Szabolcs
>
>
>
> On 16/02/2011 12:49, "mano m" <[email protected]<mailto:
[email protected]>> wrote:
> Hi Danny,
>
> cts:element-value-match() will return the Value of the element "Surname".
My requirement need the element "Surname" itself. Please let me know how to
compose the cts:element-value-match() to get the element. I tried in the
following way
>
> cts:search(fn:collection("UserDetails")//User,
> cts:and-query((
> cts:element-value-match(xs:QName("Surname"), "J*")
> ))
> )
>
> Please suggest the alternate way.I also tried with range query. I am
getting the "XDMP-EXPNTREECACHEFULL" error.
>
> cts:search(fn:collection("UserDetails")//User,
> cts:and-query((
> cts:element-range-query(xs:QName("Surname"),">=","A"),
> cts:element-range-query(xs:QName("Surname"),"<","B")
> ))
> Regards,
> Mano
> ________________________________
> From: Danny Sokolsky <[email protected]>
> To: General MarkLogic Developer Discussion <
[email protected]>
> Sent: Fri, 11 February, 2011 3:29:35 AM
> Subject: Re: [MarkLogic Dev General] Alternate for wildcard search
>
> Hi Mano,
>
> In your original email, you say you need to display a list of names that
match a pattern. Similar to Szabolcs’ suggestion of using a range query, you
can use the lexicon functions which just return the values from the range
index. And range indexes are fast. cts:element-value-match is probably what
you want. Something like:
>
> cts:element-value-match(“xs:QName(“Surname”), “J*”)
>
> You can also pass this a cts:query if you want to constrain the lexicon
look-up to fragments that match a query.
>
> You should only need to use cts:search if you want your results in
relevance order.
>
> Hope that helps,
> -Danny
>
>
> From: [email protected]<mailto:
[email protected]> [mailto:
[email protected]] On Behalf Of Illes, Szabolcs
> Sent: Thursday, February 10, 2011 7:47 AM
> To: General MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Alternate for wildcard search
>
> Hi,
>
> What about using element-range-query, like:
>
> cts:search( fn:collection("UserDetails")//User,
> cts:and-query((
> cts:element-range-query(xs:QName(" Surname"),">=","S"),
> cts:element-range-query(xs:QName(" Surname"),"<","T")
> ))
> )
>
> You need to setup a string range index on Surname
>
> Szabolcs
>
>
>
>
> On 10/02/2011 11:25, "Geert Josten" <[email protected]<mailto:
[email protected]>> wrote:
> Hi Mano,
>
> You could do
fn:collection("UserDetails")//User//Surname[fn:starts-with(‘J’, .)], but I
don’t really expect that to be faster than using the wildcard option of the
query. Could even be that above expression is optimized to your query.
>
> Kind regards,
> Geert
>
>
> Van: [email protected]<mailto:
[email protected]> [mailto:
[email protected]] Namens mano m
> Verzonden: donderdag 10 februari 2011 11:44
> Aan: [email protected]<mailto:
[email protected]>
> Onderwerp: [MarkLogic Dev General] Alternate for wildcard search
>
>
> Hi,
>
>
>
> In my application I have to display the list user name starts with the
character choosen by the User. In the ML database all the Wildcard options
are disabled. I have enabled the Wildcard in cts:element-word-query()
directly , which slow down the query execution. Is there anyother way to get
the user names starts with specific character?
>
>
>
> Sample query:
>
> cts:search (fn:collection("UserDetails")//User,
> cts:element-word-query(xs:QName ("Surname"),"J*", "wildcarded"))
>
>
>
> Regards,
>
> Mano
> ________________________________
>
> _______________________________________________
> General mailing list
> [email protected]<mailto:[email protected]>
> http://developer.marklogic.com/mailman/listinfo/general
>
>
********************************************************************************
> DISCLAIMER: This e-mail is confidential and should not be used by anyone
who is
> not the original intended recipient. If you have received this e-mail in
error
> please inform the sender and delete it from your mailbox or any other
storage
> mechanism. Neither Macmillan Publishers Limited nor any of its agents
accept
> liability for any statements made which are clearly the sender's own and
not
> expressly made on behalf of Macmillan Publishers Limited or one of its
agents.
> Please note that neither Macmillan Publishers Limited nor any of its
agents
> accept any responsibility for viruses that may be contained in this e-mail
or
> its attachments and it is your responsibility to scan the e-mail and
> attachments (if any). No contracts may be concluded on behalf of Macmillan
> Publishers Limited or its agents by means of e-mail communication.
Macmillan
> Publishers Limited Registered in England and Wales with registered number
785998
> Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
>
********************************************************************************
>
> ________________________________
> _______________________________________________
> General mailing list
> [email protected]<mailto:[email protected]>
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to