[MarkLogic Dev General] Filtering values from cts:element-values

Geert Josten Geert.Josten at daidalos.nl
Tue Nov 9 10:12:01 PST 2010


Hi DJ,

Many small fragments will work just fine in MarkLogic Server. If you specify a fragment root, you won't notice a difference yourself, apart from changed searching behaviour (and perhaps performance impact). I suggest simply trying it, and see how well it performs.

The thing is that the indexes are always fragment-based, though you can specify searchable paths with functions like cts:search.

Kind regards,
Geert

> -----Original Message-----
> From: general-bounces at developer.marklogic.com 
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of 
> DJaun Maclin
> Sent: dinsdag 9 november 2010 18:14
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Filtering values from 
> cts:element-values
> 
> Hi Greet,
> 
> Thanks for the response! I don't have Person set up as 
> Fragment Root because there are a lot of Person tags in a 
> document, so there would be too many small fragments for my comfort. 
> 
> Is it a good idea fragment nodes so small like: 
> <Person gender="male" NMRule="Unknown" kind="PN"
> rule="Unknown">Roberts</Person>
> 
> Can you think of any other ways besides fragmenting the 
> Person element?
> 
> Is there a way where I can direct the query (cts:query) to 
> apply towards filtering elements instead of filter documents?
> 
> 
> Thanks
> DJ
> 
> -----Original Message-----
> From: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of 
> Geert Josten
> Sent: Tuesday, November 09, 2010 10:32 AM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Filtering values from 
> cts:element-values
> 
> Hi DJ,
> 
> Do you have Person marked as Fragment Root? If not, then 
> queries can return more Persons than you might expect.
> 
> Kind regards,
> Geert
> 
> >
> 
> 
> drs. G.P.H. (Geert) Josten
> Consultant
> 
> Daidalos BV
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> 
> T +31 (0)10 850 1200
> F +31 (0)10 850 1199
> 
> mailto:geert.josten at daidalos.nl
> http://www.daidalos.nl/
> 
> KvK 27164984
> 
> 
> De informatie - verzonden in of met dit e-mailbericht - is 
> afkomstig van Daidalos BV en is uitsluitend bestemd voor de 
> geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, 
> verzoeken wij u het te verwijderen. Aan dit bericht kunnen 
> geen rechten worden ontleend.
> 
> > From: general-bounces at developer.marklogic.com
> > [mailto:general-bounces at developer.marklogic.com] On Behalf Of DJaun 
> > Maclin
> > Sent: dinsdag 9 november 2010 16:47
> > To: General at developer.marklogic.com
> > Subject: [MarkLogic Dev General] Filtering values from 
> > cts:element-values
> >
> > Hi everyone,
> >
> >
> >
> > I'm trying to find a way to filter elements based on their 
> attribute 
> > from the results of cts:element-values, but I'm having 
> trouble. Here's 
> > a query that attempts to solve this problem, but doesn't:
> >
> >
> >
> > Xquery:
> >
> > let $facet :=
> >
> > cts:element-values(xs:QName("Person"), (), ("item-frequency", 
> > "collation=http://marklogic.com/collation/en/S1/AS/T0020"),
> >
> > cts:and-query((
> >
> > cts:element-attribute-range-query(xs:QName('Person'),xs:QName(
> > 'rule1'), "=", "PersonFull" ,
> > ('collation=http://marklogic.com/collation/en/S1/AS/T0020')),
> >
> > cts:document-query("/content/article/xml/94D99B3BB694A4DCBAA4C
> > 1E50158D485.xml")
> >
> > ))
> >
> > )
> >
> > return $facet
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Here's a little piece of the document [from 
> > cts:document-query("/content/article/xml/94D99B3BB694A4DCBAA4C
> > 1E50158D485.xml")]:
> >
> >
> >
> > <Person rule1="PersonFull" gender="male"
> > rule="PersonFinal"><Lookup majorType="person_first" 
> minorType="male">
> >
> > <FirstPerson gender="male"
> > rule="FirstName">Travis</FirstPerson></Lookup> Lubitz</Person>
> >
> > <Person gender="male" NMRule="Unknown" kind="PN"
> > rule="Unknown">Roberts</Person>
> >
> > <Person gender="male" NMRule="Unknown" kind="PN"
> > rule="Unknown" xmlns>Lubitz</Person>
> >
> >
> >
> >
> >
> >
> >
> > In this case I want to see:
> >
> > Travis Lubitz
> >
> >
> >
> >
> >
> > But I'm getting the following:
> >
> > Travis Lubitz
> >
> > Roberts
> >
> > Lubitz
> >
> >
> >
> >
> >
> >
> >
> > This doesn't work for giving me all of the 'Person' 
> elements with the 
> > attribute 'rule1' being equal to 'PersonFull'
> >
> > The query still brings in all 'Person' elements, but how 
> can I filter 
> > the list of 'Person' instead of getting back all 'Person' 
> elements in 
> > a document? I don't want any element returned back from 
> element-values 
> > that the attribute 'rule1'
> > is not equal to 'PersonFull'. Is there a better way of doing this?
> >
> >
> >
> >
> >
> > Thanks in advance,
> >
> >
> >
> > DJ
> >
> >
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> 


More information about the General mailing list