Hi Fabian,

So, the main xmls are final search results, right? You're best off with a
two-pass search. What you are looking for is a list of uris of all
secondary xml's that contain tags with particular values. Using that list
you can do a search on text elements and main xmls having secondary xmls
as an include href. Something like this:

let $uris :=
        cts:uris((), (),
                cts:and-query((
                        cts:collection-query("secondaryDocuments"),
                        cts:element-value-query(xs:QName(“tag”), “Study”)
                ))
        )
return
        cts:search( fn:collection(“mainDocuments”) ,
                cts:and-query((
                        cts:element-value-query(xs:QName(“text”),
“Introduction”),

cts:element-attribute-value-query(xs:QName("xi:include"),
xs:QName("href"), $uris)
                ))
        )

This does pose limits to the nesting of such modular documents. For
documents that are nested two deep, you may need a 3-pass search, and so
on.

In that respect, it might be easier to use the fragmentation features of
MarkLogic. Searches in MarkLogic are optimized to return fragments, but if
you search a parent fragment, sub-fragments are automatically included in
the query evaluation. There is more to it, but it might be worth
considering.

On the other hand, is there a particular reason to have your content
denormalized like that at all?

Kind regards,
Geert

> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:general-
> [email protected]] Namens Fabian Jaramillo
> Verzonden: woensdag 6 november 2013 18:21
> Aan: [email protected]
> Onderwerp: [MarkLogic Dev General] Search allowing filter with modular
> documents
>
> Hello,
>
> I have a modular document with xinclude in my database, example:
>
> main.xml
>
> <main>
> <item id=“1”>
> <xi:include href=“/documents/item1.xml” />
> <text>Introduction</text>
> </item>
> </main>
>
> item1.xml
>
> <body>
> <p>Hello world</p>
> <tags>
> <tag>Study</tag>
> <tag>Development</tag>
> </tags>
> </body>
>
>
> so, I want to make a search when I can filter all the main files and
make
> some filters to the item1.xml. something like this:
>
>
> cts:search( fn:collection(“mainDocuments”) ,
>                       cts:and-query((
>                               cts:element-value-query(xs:QName(“text”),
> “Introduction”),
>                               cts:element-value-query(xs:QName(“tag”),
> “Study”)
>                       ))
>               )
>
>
> is it possible to achieve with Marklogic?
>
> --
> FABIAN JARAMILLO ORDOÑEZ
> SOFTWARE ARCHITECT
> Yuxi Pacific Latam S.A.S
> Carrera 38 #10-36 Oficinas 801/802
> Medellín, Antioquia, Colombia.
> Tel: +57-4-2661968/2661977
> Mobile: +57-300-2098933
> Skype: yuxi-fabian
> http://www.yuxipacific.com/
>
> _______________________________________________
> 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