Re: [MarkLogic Dev General] Searches not enabled

2012-04-16 Thread Steiner, David J. (LNG-DAY)
Looks like word searches just hadn't completed indexing... Nothing to see here... :-) -Original Message- From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley Sent: Friday, April 13, 2012 3:51 PM To: MarkLogic

[MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread Gary Larsen
Hi I'm trying to convert a query to use cts for performance. Is there a cts constructor that I can use the check a variable? Here's a portion of the query: xdmp:directory('/db/netvisn/audit_history/','infinity') /nv:auditHistory

Re: [MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread Michael Blakeley
The quick answer is something like: if ($oc) then () else cts:element-value-query(xs:QName(nv:objectClass), $oc) When $oc is empty, there is no need to include that query term at all. So it can be empty too. However, the long answer is that converting an XPath expression to cts:query won't

Re: [MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread John Snelson
Only add the cts:element-value-query() to your cts:query object if $effect eq 'spec'. In other words, do the comparison outside the cts:query, and build a different cts:query depending on the value of the variables. John On 16/04/12 16:21, Gary Larsen wrote: Hi I’m trying to convert a

Re: [MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread Gary Larsen
I'm worried about scalability in a large database and other xquery conversions have really increased performance. What I'm trying now is to build the cts query string dynamically where I can use 'if then else' to add the necessary cts syntax, and then do xdmp:eval() on the string in cts:search.

Re: [MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread Michael Blakeley
Unless I'm missing something, you shouldn't need the eval. Constructors for cts:query are already fully composable. See the if-then-else expression that I outlined below. -- Mike On 16 Apr 2012, at 09:04 , Gary Larsen wrote: I'm worried about scalability in a large database and other xquery

Re: [MarkLogic Dev General] simple cts constructor for variable check

2012-04-16 Thread Gary Larsen
I think it's sinking in! Thanks for your help. Gary -Original Message- From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley Sent: Monday, April 16, 2012 12:19 PM To: MarkLogic Developer Discussion Subject: Re:

[MarkLogic Dev General] another cts query question

2012-04-16 Thread Gary Larsen
Is it possible to use date functions in combination with any cts query constructors? For example: xs:date(xs:dateTime(nv:timestamp)) eq fn:current-date()] fn:days-from-duration(fn:current-date() - xs:date(xs:dateTime(nv:timestamp))) le 3] Thanks, Gary

Re: [MarkLogic Dev General] another cts query question

2012-04-16 Thread Geert Josten
Hi Gary, I guess it is easiest to calculate date ranges for that. The first would match timestamps between xs:dateTime(fn:concat(fn:current-date(),”T00:00:00Z”)) and xs:dateTime(fn:concat(fn:current-date() + xs:dayTimeDuration(“P1D”),”T00:00:00Z”)). You can use a cts:and-query on two

Re: [MarkLogic Dev General] another cts query question

2012-04-16 Thread David Lee
Another way of looking this is that *any* single value used in a cts query just like any expression can be computed instead of constant, but realize the computation of the expression is done at the time the cts expression is composed, not when its run. Think of creating a cts query expression

Re: [MarkLogic Dev General] How to use near query in search:search function

2012-04-16 Thread Steiner, David J. (LNG-DAY)
Is there a way to specify “ordered”? I see: joiner strength=30 apply=near2 consume=2 element=cts:near-queryNEAR//joiner” And “near2”s implementation… So, would I actually have to add a similar block if I wanted to get “ordered” to happen? From: general-boun...@developer.marklogic.com

Re: [MarkLogic Dev General] How to use near query in search:search function

2012-04-16 Thread Micah Dubinko
I believe you can add options=ordered to the joiner element here. -m On Apr 16, 2012, at 12:14 PM, Steiner, David J. (LNG-DAY) wrote: Is there a way to specify “ordered”? I see: joiner strength=30 apply=near2 consume=2 element=cts:near-queryNEAR//joiner” And “near2”s implementation… So,

Re: [MarkLogic Dev General] How to use near query in search:search function

2012-04-16 Thread Steiner, David J. (LNG-DAY)
Appears to work!!! Thanks!!! From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Micah Dubinko Sent: Monday, April 16, 2012 3:35 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] How to use near query in