Re: [MarkLogic Dev General] cts:element-range-query for months in a date

2014-10-10 Thread David Ennis
I would suggest that you pre-process your documents to include an attribute
of the xs:gMonth datatype (just the month digits) and add a range index on
this.

The the query is absolutely specific:  *cts:element-attribute-query([your
attribute], ">", 10)*



Kind Regards,
David Ennis


David Ennis
*Content Engineer*

[image: HintTech]  
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[image: http://www.hinttech.com] 
  


On 10 October 2014 18:08, Danny Sinang  wrote:

> We have a "publicationDate" element in the form "-MM-DD".
>
> How do I issue a cts:element-range-query against it to list all documents
> whose publicationDate month is greater than 10 ?
>
>
>
> Regards,
> Danny
>
>
>
>
>
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] cts:element-range-query for months in a date

2014-10-10 Thread Danny Sinang
We have a "publicationDate" element in the form "-MM-DD".

How do I issue a cts:element-range-query against it to list all documents
whose publicationDate month is greater than 10 ?



Regards,
Danny
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] CTS Path restrictions

2014-10-10 Thread Dominic Beesley
Hello,

 

I've been playing around with cts:search trying to get performance better on
our data set. I'm having a few problems! 

 

The data (simplified here) is a set of nested  elements which
represent the root, chapter, section, etc levels of a document. Each 
contains a  which in turn controls  elements - each field
element has a @type attribute which indicates its type. The structure of the
data cannot be changed.

 

Firstly, how do I search for a word in an element with a particular
attribute i.e. in the example below look for the word "queries" in
field[@type='title'] (example 1 is what I thought worked but it doesn't it
returns the hits on the precis field too)

 

Secondly, how do I search for something only at the root level i.e. if I
just wanted to match a word in /d/auth/field[@type='title'] as opposed to
/d/auth//field[@type='titlle']

 

I know that I could use the path in the cts:search to narrow down the search
to a particular level/field but the trouble then is when I want to combine
two searches with and/or

 

i.e. I can do cts:search(doc()/d/auth/meta/field[@type='title'], 'precis')
but would I search for say "beer" in title and "pdfs" in precis.

 

I'm sure I had some of this working about 4 years ago but I can't remember
it!

 

At the moment I've got it doing something like:

 

for $r in cts:search(/d/auth/meta/field[@type='title'], 'beer') return 

,   for $r in cts:search(/d/auth/meta/field[@type='precis'],
'pdfs') return 

 

 

The application then does the combination and score arithmetic. Trouble is
that the $r/ancestor::. bit is quite slow on large sets and a lot of
information is returned to the app from the server which when doing an "and"
is usually a lot larger than the intersection. I could probably do the
intersection in XQuery too but I suspect the combining and finding the root
id bit would still be slow?

 

Any pointers appreciated!

 

D

 

 

xdmp:document-insert('domtest.xml',





  

The Book of Queries

One man's struggle to overcome confusion
and reach enlightenment

  





  

Misunderstanding CTS

My autobiography

  

  



  Chapter 1

  Queries explained



  





  

The good beer guid

What you really should be reading instead
of pdfs about queries

  

  



  Chapter 1

  Timoth Taylor



  



);

 

EXAMPLE 1: NOT WORKING - look for "queries" in field "title"

 

declare namespace xm="http://xsd.oup.com/xauth/meta";

 

for $r in cts:search(doc('domtest.xml')/d/auth, 

  cts:element-query(xs:QName('meta'), 

cts:and-query((

  cts:element-attribute-value-query(xs:QName('field'),
xs:QName('type'), 'title')

, cts:element-word-query(xs:QName('field'), 'queries')

))

  )

)

return

  

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general