Re: [EXTERNAL] Re: Defining an index on a choice element

"Harris, Bernard T. \(GSFC-5870\) via Exist-open" <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <[email protected]>
Thanks for the reply.  However, after defining a range index for all 14 choices and indexing the collection, the performance is the same (3 minutes instead of less than a second when the name of the element is hard coded).  Is there anything else I can do with a range index?  Thanks.

Bernie

From: Joe Wicentowski <[email protected]>
Date: Tuesday, November 15, 2022 at 2:34 PM
To: "Harris, Bernard T. (GSFC-5870)" <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: [EXTERNAL] Re: [Exist-open] Defining an index on a choice element

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<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fexist-db.org%2Fexist%2Fapps%2Fdoc%2Flucene%23facets-and-fields&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cff137e443f76494eae1208dac7401364%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638041376755976347%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=SFNBrFsFL2HaXPqykp7t56GjRfOfgvkXcBBDlZpP%2BIY%3D&reserved=0>.

Joe

On Tue, Nov 15, 2022 at 7:28 AM Harris, Bernard T. (GSFC-5870) via Exist-open <[email protected]<mailto:[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<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspase-group.org%2Fdata%2Fschema%2Fspase-2.5.0.xsd&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cff137e443f76494eae1208dac7401364%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638041376755976347%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=xd0gi6EnRf1IN8AOC%2B1jg33zkhVtFPTJEDZIbFmOuGc%3D&reserved=0>
…
   <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]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/exist-open<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cff137e443f76494eae1208dac7401364%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638041376755976347%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=fDOpX8JdKGlXJeWWQuY7rFpZXpoOtyFVM8%2FlDps9CSs%3D&reserved=0>

_______________________________________________
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.