Re: Defining an index on a choice element

Joe Wicentowski <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <CAHwerk0UWMKsdXe7aL=p8n3VK03ta7iH=E_a8C3K3JwFGaqiCg@mail.gmail.com>
Hi Bernie,

Yes, if you're using range indexes you need to define them one index per
element/attribute qname. For a somewhat more flexible approach, you might
be able to use facets and/or fields - see
https://exist-db.org/exist/apps/doc/lucene#facets-and-fields.

Joe

On Tue, Nov 15, 2022 at 7:28 AM Harris, Bernard T. (GSFC-5870) via
Exist-open <[email protected]> wrote:

> I need to do queries like
>
>
>
> Let $docs := collection(“/db/SPASE”)
>
> Let $type := “NumericalData”
>
> Let $result := $docs/Spase/*[name() = $type]
>
>
>
> Where $type may be the name of any one of many “choice” elements from the
> schema https://spase-group.org/data/schema/spase-2.5.0.xsd
>
> …
>
>    <xsd:complexType name="Spase">
>
>       <xsd:sequence>
>
>          <xsd:element name="Version" type="spase:Version" minOccurs="1"
> maxOccurs="1" />
>
>          <xsd:choice minOccurs="1" maxOccurs="unbounded">
>
>             <xsd:element name="Collection" type="spase:Collection" />
>
>             <xsd:element name="Catalog" type="spase:Catalog" />
>
>             <xsd:element name="DisplayData" type="spase:DisplayData" />
>
>             <xsd:element name="NumericalData" type="spase:NumericalData" />
>
>             <xsd:element name="Document" type="spase:Document" />
>
>             <xsd:element name="Software" type="spase:Software" />
>
>             <xsd:element name="Granule" type="spase:Granule" />
>
>             <xsd:element name="Instrument" type="spase:Instrument" />
>
>             <xsd:element name="Observatory" type="spase:Observatory" />
>
>             <xsd:element name="Person" type="spase:Person" />
>
>             <xsd:element name="Registry" type="spase:Registry" />
>
>             <xsd:element name="Repository" type="spase:Repository" />
>
>             <xsd:element name="Service" type="spase:Service" />
>
>             <xsd:element name="Annotation" type="spase:Annotation" />
>
>          </xsd:choice>
>
>       </xsd:sequence>
>
>          <xsd:attribute name="lang" type="xsd:string" default="en"/>
>
>    </xsd:complexType>
>
> …
>
> As expected, this performs poorly without a range index.  But what is the
> qname of the choice?  Do I have to define an index for each choice?  That
> is, 14 range indexes for Collection, Catalog, ….  Thanks.
>
>
>
> Bernie
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.