Hi,

What¹s your exact data structure ? Is User a fragment root?

What does xdmp:estimate( //User ) return?

U could select just Surnames like this:

cts:search(fn:collection("UserDetails")//Surname,
>> cts:and-query(( 
>>     cts:element-range-query(xs:QName("Surname"),">=","A"),
>>     cts:element-range-query(xs:QName("Surname"),"<","B")
  ))

Szabolcs

On 16/02/2011 13:57, "mano m" <[email protected]> wrote:

> 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]> 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]] 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]> 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]] Namens mano m
>> Verzonden: donderdag 10 februari 2011 11:44
>> Aan: [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]
>> 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]
>> http://developer.marklogic.com/mailman/listinfo/general
>> 
>> 
>> 
>> _______________________________________________
>> General mailing list
>> [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