indexer.xsd 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  9. <xs:complexType name="indexerType" mixed="true">
  10. <xs:annotation>
  11. <xs:documentation>
  12. Indexer declaration.
  13. </xs:documentation>
  14. </xs:annotation>
  15. <xs:sequence>
  16. <xs:choice minOccurs="0" maxOccurs="unbounded">
  17. <xs:element name="title" type="translatableType" />
  18. <xs:element name="description" type="translatableType" />
  19. <xs:element name="saveHandler" type="saveHandlerType" />
  20. <xs:element name="structure" type="structureType" />
  21. <xs:group ref="fieldset"/>
  22. </xs:choice>
  23. <xs:group ref="dependencies"/>
  24. </xs:sequence>
  25. <xs:attribute name="id" type="xs:string" use="required" />
  26. <xs:attribute name="primary" type="nameType" use="optional" />
  27. <xs:attribute name="view_id" type="viewIdType" use="optional" />
  28. <xs:attribute name="class" type="classType" use="optional" />
  29. <xs:attribute name="shared_index" type="xs:string" use="optional" />
  30. </xs:complexType>
  31. <xs:group name="fieldset">
  32. <xs:choice>
  33. <xs:element name="fieldset" type="fieldsetType">
  34. <xs:unique name="uniqueField">
  35. <xs:annotation>
  36. <xs:documentation>
  37. Field name must be unique in one fieldset.
  38. </xs:documentation>
  39. </xs:annotation>
  40. <xs:selector xpath=".//fieldset/field"/>
  41. <xs:field xpath="@name"/>
  42. </xs:unique>
  43. </xs:element>
  44. </xs:choice>
  45. </xs:group>
  46. <xs:complexType name="translatableType">
  47. <xs:simpleContent>
  48. <xs:extension base="xs:string">
  49. <xs:attribute name="translate" use="optional" fixed="true" type="xs:boolean"/>
  50. </xs:extension>
  51. </xs:simpleContent>
  52. </xs:complexType>
  53. <xs:simpleType name="viewIdType">
  54. <xs:annotation>
  55. <xs:documentation>
  56. View ID can contain only [a-zA-Z0-9_].
  57. </xs:documentation>
  58. </xs:annotation>
  59. <xs:restriction base="xs:string">
  60. <xs:pattern value="[a-zA-Z0-9_]+" />
  61. </xs:restriction>
  62. </xs:simpleType>
  63. <xs:simpleType name="classType">
  64. <xs:annotation>
  65. <xs:documentation>
  66. Class name can contain only [a-zA-Z\].
  67. </xs:documentation>
  68. </xs:annotation>
  69. <xs:restriction base="xs:string">
  70. <xs:pattern value="[a-zA-Z\\]+" />
  71. </xs:restriction>
  72. </xs:simpleType>
  73. <xs:simpleType name="fromType">
  74. <xs:annotation>
  75. <xs:documentation>
  76. From attribute can contain only [a-zA-Z0-9_].
  77. </xs:documentation>
  78. </xs:annotation>
  79. <xs:restriction base="xs:string">
  80. <xs:pattern value="[a-zA-Z0-9_]+" />
  81. </xs:restriction>
  82. </xs:simpleType>
  83. <xs:simpleType name="toType">
  84. <xs:annotation>
  85. <xs:documentation>
  86. To attribute can contain only [a-zA-Z0-9_].
  87. </xs:documentation>
  88. </xs:annotation>
  89. <xs:restriction base="xs:string">
  90. <xs:pattern value="[a-zA-Z0-9_]+" />
  91. </xs:restriction>
  92. </xs:simpleType>
  93. <xs:simpleType name="originType">
  94. <xs:annotation>
  95. <xs:documentation>
  96. To attribute can contain only [a-zA-Z0-9_].
  97. </xs:documentation>
  98. </xs:annotation>
  99. <xs:restriction base="xs:string">
  100. <xs:pattern value="[a-zA-Z0-9_]+" />
  101. </xs:restriction>
  102. </xs:simpleType>
  103. <xs:simpleType name="nameType">
  104. <xs:annotation>
  105. <xs:documentation>
  106. Class name can contain only [a-zA-Z\].
  107. </xs:documentation>
  108. </xs:annotation>
  109. <xs:restriction base="xs:string">
  110. <xs:pattern value="[a-zA-Z0-9_]+" />
  111. </xs:restriction>
  112. </xs:simpleType>
  113. <xs:complexType name="fieldTypeAbstract" abstract="true">
  114. <xs:annotation>
  115. <xs:documentation>
  116. Index field declaration.
  117. </xs:documentation>
  118. </xs:annotation>
  119. <xs:attribute name="name" type="nameType" use="required"/>
  120. <xs:attribute name="handler" type="classType" use="optional"/>
  121. <xs:attribute name="origin" type="originType" use="optional"/>
  122. </xs:complexType>
  123. <xs:complexType name="fieldsetType" mixed="true">
  124. <xs:annotation>
  125. <xs:documentation>
  126. Fieldset of field declaration.
  127. </xs:documentation>
  128. </xs:annotation>
  129. <xs:sequence>
  130. <xs:element type="referenceType" name="reference" minOccurs="0" maxOccurs="unbounded" />
  131. <xs:element name="field" type="fieldType" minOccurs="0" maxOccurs="unbounded"/>
  132. </xs:sequence>
  133. <xs:attribute name="source" type="classType" use="optional"/>
  134. <xs:attribute name="provider" type="classType" use="optional"/>
  135. <xs:attribute name="name" type="nameType" use="required"/>
  136. </xs:complexType>
  137. <xs:complexType name="fieldType">
  138. <xs:complexContent>
  139. <xs:extension base="fieldTypeAbstract">
  140. <xs:choice>
  141. <xs:element type="filterType" name="filter" minOccurs="0" maxOccurs="1" />
  142. </xs:choice>
  143. <xs:attribute type="dataType" name="dataType" use="optional" />
  144. </xs:extension>
  145. </xs:complexContent>
  146. </xs:complexType>
  147. <xs:complexType name="filterType">
  148. <xs:annotation>
  149. <xs:documentation>
  150. Index field filter.
  151. </xs:documentation>
  152. </xs:annotation>
  153. <xs:attribute name="class" type="classType" use="required"/>
  154. </xs:complexType>
  155. <xs:complexType name="structureType">
  156. <xs:annotation>
  157. <xs:documentation>
  158. Structure type.
  159. </xs:documentation>
  160. </xs:annotation>
  161. <xs:attribute name="class" type="classType" use="required"/>
  162. </xs:complexType>
  163. <xs:complexType name="saveHandlerType">
  164. <xs:annotation>
  165. <xs:documentation>
  166. SaveHandler type.
  167. </xs:documentation>
  168. </xs:annotation>
  169. <xs:attribute name="class" type="classType" use="required"/>
  170. </xs:complexType>
  171. <xs:complexType name="referenceType">
  172. <xs:annotation>
  173. <xs:documentation>
  174. Index field reference.
  175. </xs:documentation>
  176. </xs:annotation>
  177. <xs:attribute name="fieldset" type="nameType" use="required"/>
  178. <xs:attribute name="from" type="fromType" use="optional"/>
  179. <xs:attribute name="to" type="toType" use="optional"/>
  180. </xs:complexType>
  181. <xs:simpleType name="dataType">
  182. <xs:restriction base="xs:string">
  183. <xs:enumeration value="int" />
  184. <xs:enumeration value="float" />
  185. <xs:enumeration value="varchar" />
  186. <xs:enumeration value="text" />
  187. <xs:enumeration value="mediumtext" />
  188. <xs:enumeration value="timestamp" />
  189. <xs:enumeration value="datetime" />
  190. <xs:enumeration value="date" />
  191. </xs:restriction>
  192. </xs:simpleType>
  193. <xs:complexType name="searchable">
  194. <xs:complexContent>
  195. <xs:extension base="fieldType"/>
  196. </xs:complexContent>
  197. </xs:complexType>
  198. <xs:complexType name="filterable">
  199. <xs:complexContent>
  200. <xs:extension base="fieldType"/>
  201. </xs:complexContent>
  202. </xs:complexType>
  203. <xs:element name="config" type="configType">
  204. <xs:unique name="uniqueIndexerId">
  205. <xs:annotation>
  206. <xs:documentation>
  207. Indexer Id must be unique.
  208. </xs:documentation>
  209. </xs:annotation>
  210. <xs:selector xpath="indexer" />
  211. <xs:field xpath="@id" />
  212. </xs:unique>
  213. <xs:unique name="uniqueViewId">
  214. <xs:annotation>
  215. <xs:documentation>
  216. Indexer Id must be unique.
  217. </xs:documentation>
  218. </xs:annotation>
  219. <xs:selector xpath="indexer" />
  220. <xs:field xpath="@view_id" />
  221. </xs:unique>
  222. </xs:element>
  223. <xs:complexType name="configType">
  224. <xs:sequence>
  225. <xs:element ref="indexer" minOccurs="1" maxOccurs="unbounded"/>
  226. </xs:sequence>
  227. </xs:complexType>
  228. <xs:element name="indexer" type="indexerType">
  229. <xs:unique name="uniqueFieldset">
  230. <xs:annotation>
  231. <xs:documentation>
  232. Fieldset name must be unique.
  233. </xs:documentation>
  234. </xs:annotation>
  235. <xs:selector xpath=".//fieldset"/>
  236. <xs:field xpath="@name"/>
  237. </xs:unique>
  238. </xs:element>
  239. <xs:group name="dependencies">
  240. <xs:choice>
  241. <xs:element minOccurs="0" maxOccurs="1" name="dependencies" type="indexerDependencies">
  242. <xs:unique name="uniqueIndexerDependency">
  243. <xs:annotation>
  244. <xs:documentation>
  245. Related indexer id must be unique.
  246. </xs:documentation>
  247. </xs:annotation>
  248. <xs:selector xpath="indexer" />
  249. <xs:field xpath="@id" />
  250. </xs:unique>
  251. </xs:element>
  252. </xs:choice>
  253. </xs:group>
  254. <xs:complexType name="indexerDependencies">
  255. <xs:annotation>
  256. <xs:documentation>
  257. Root element of the indexer dependencies.
  258. </xs:documentation>
  259. </xs:annotation>
  260. <xs:sequence maxOccurs="unbounded">
  261. <xs:element minOccurs="0" maxOccurs="unbounded" name="indexer">
  262. <xs:complexType>
  263. <xs:annotation>
  264. <xs:documentation>
  265. Indexer dependency that represents another indexer.
  266. </xs:documentation>
  267. </xs:annotation>
  268. <xs:attribute name="id" type="xs:string" use="required" />
  269. </xs:complexType>
  270. </xs:element>
  271. </xs:sequence>
  272. </xs:complexType>
  273. </xs:schema>