Permalink
Browse files

EZP-23329: first implementation of Elasticsearch storage

  • Loading branch information...
pspanja committed Oct 22, 2014
1 parent f5d7d11 commit 5d0924fdc14ada04c3d74217e529837e261a796f
Showing with 19,378 additions and 57 deletions.
  1. +8 −0 .travis.yml
  2. +65 −0 bin/.travis/init_elasticsearch.sh
  3. +117 −0 doc/specifications/storage_engines/elasticsearch.md
  4. +165 −0 eZ/Bundle/EzPublishElasticsearchBundle/Command/ElasticsearchCreateIndexCommand.php
  5. +39 −0 eZ/Bundle/EzPublishElasticsearchBundle/DependencyInjection/EzPublishElasticsearchExtension.php
  6. +38 −0 eZ/Bundle/EzPublishElasticsearchBundle/EzPublishElasticsearchBundle.php
  7. +6 −50 eZ/Publish/API/Repository/Tests/SearchServiceLocationTest.php
  8. +486 −6 eZ/Publish/API/Repository/Tests/SearchServiceTest.php
  9. +134 −0 eZ/Publish/API/Repository/Tests/SetupFactory/LegacyElasticsearch.php
  10. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/ContentId.php
  11. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/ContentTypeGroupId.php
  12. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/ContentTypeId.php
  13. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataBetween.php
  14. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataCreated.php
  15. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataGt.php
  16. +60 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataGte.php
  17. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataIn.php
  18. +126 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DateMetadataLte.php
  19. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DeprecatedContentIdQuery.php
  20. +71 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Depth.php
  21. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DepthGt.php
  22. +159 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DepthGte.php
  23. +93 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DepthIn.php
  24. +192 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/DepthLte.php
  25. +47 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FacetContentType.php
  26. +45 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FacetContentTypeMinCount.php
  27. +47 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FacetContentTypeMinLimit.php
  28. +46 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FacetSection.php
  29. +46 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FacetUser.php
  30. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Field.php
  31. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FieldBetween.php
  32. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FieldIn.php
  33. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/FieldOr.php
  34. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LanguageCode.php
  35. +82 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LanguageCodeAlwaysAvailable.php
  36. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LanguageCodeIn.php
  37. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/ContentId.php
  38. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/ContentTypeGroupId.php
  39. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/ContentTypeId.php
  40. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataBetween.php
  41. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataCreated.php
  42. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataGt.php
  43. +60 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataGte.php
  44. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataIn.php
  45. +126 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DateMetadataLte.php
  46. +71 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/Depth.php
  47. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DepthGt.php
  48. +159 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DepthGte.php
  49. +93 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DepthIn.php
  50. +192 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/DepthLte.php
  51. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/FieldBetween.php
  52. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LanguageCode.php
  53. +82 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LanguageCodeAlwaysAvailable.php
  54. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LanguageCodeIn.php
  55. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LocationId.php
  56. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LocationRemoteId.php
  57. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LogicalAnd.php
  58. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LogicalNot.php
  59. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/LogicalOr.php
  60. +16 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/MatchNone.php
  61. +71 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/ParentLocationId.php
  62. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/RemoteId.php
  63. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SectionId.php
  64. +148 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortContentName.php
  65. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortDatePublished.php
  66. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortDesc.php
  67. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortLocationDepth.php
  68. +60 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortMultiple.php
  69. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortNone.php
  70. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortPathString.php
  71. +170 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortSectionIdentifier.php
  72. +170 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/SortSectionName.php
  73. +214 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/Status.php
  74. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/Subtree.php
  75. +214 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Location/Visibility.php
  76. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LocationId.php
  77. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LocationRemoteId.php
  78. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LogicalAnd.php
  79. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LogicalNot.php
  80. +49 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/LogicalOr.php
  81. +16 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/MatchNone.php
  82. +71 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/ParentLocationId.php
  83. +27 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/QueryCustomField.php
  84. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/QueryModifiedField.php
  85. +38 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/RemoteId.php
  86. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SectionId.php
  87. +148 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortContentName.php
  88. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortDatePublished.php
  89. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortDesc.php
  90. +82 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortFolderName.php
  91. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortLocationDepth.php
  92. +60 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortMultiple.php
  93. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortNone.php
  94. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortPathString.php
  95. +170 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortSectionIdentifier.php
  96. +170 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/SortSectionName.php
  97. +214 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Status.php
  98. +104 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Subtree.php
  99. +214 −0 eZ/Publish/API/Repository/Tests/_fixtures/Elasticsearch/Visibility.php
  100. +53 −0 eZ/Publish/Core/Base/Container/Compiler/Storage/Elasticsearch/AggregateFacetBuilderVisitorPass.php
  101. +53 −0 eZ/Publish/Core/Base/Container/Compiler/Storage/Elasticsearch/AggregateFieldValueMapperPass.php
  102. +45 −0 ...lish/Core/Base/Container/Compiler/Storage/Elasticsearch/AggregateSortClauseVisitorContentPass.php
  103. +45 −0 ...ish/Core/Base/Container/Compiler/Storage/Elasticsearch/AggregateSortClauseVisitorLocationPass.php
  104. +45 −0 ...lish/Core/Base/Container/Compiler/Storage/Elasticsearch/CriterionVisitorDispatcherContentPass.php
  105. +45 −0 ...ish/Core/Base/Container/Compiler/Storage/Elasticsearch/CriterionVisitorDispatcherLocationPass.php
  106. +74 −0 eZ/Publish/Core/Persistence/Cache/LocationSearchHandler.php
  107. +80 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Common/CriterionVisitor/LogicalAnd.php
  108. +87 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Common/CriterionVisitor/LogicalNot.php
  109. +79 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Common/CriterionVisitor/LogicalOr.php
  110. +48 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Common/CriterionVisitor/MatchAll.php
  111. +67 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Common/CriterionVisitor/MatchNone.php
  112. +122 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor.php
  113. +56 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ContentIdIn.php
  114. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ContentTypeGroupIdIn.php
  115. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ContentTypeIdIn.php
  116. +92 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ContentTypeIdentifierIn.php
  117. +54 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/CustomField.php
  118. +93 −0 ...lish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/CustomField/CustomFieldIn.php
  119. +86 −0 ...h/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/CustomField/CustomFieldRange.php
  120. +49 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DateMetadata.php
  121. +77 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DateMetadata/ModifiedIn.php
  122. +63 −0 ...ish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DateMetadata/ModifiedRange.php
  123. +77 −0 ...blish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DateMetadata/PublishedIn.php
  124. +63 −0 ...sh/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DateMetadata/PublishedRange.php
  125. +101 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DepthIn.php
  126. +91 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/DepthRange.php
  127. +48 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/Field.php
  128. +142 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/Field/FieldIn.php
  129. +134 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/Field/FieldRange.php
  130. +158 −0 ...Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/Field/MapLocationDistanceRange.php
  131. +128 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/LanguageCodeIn.php
  132. +101 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/LocationIdIn.php
  133. +101 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/LocationRemoteIdIn.php
  134. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ObjectStateIdIn.php
  135. +101 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/ParentLocationIdIn.php
  136. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/RemoteIdIn.php
  137. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/SectionIdIn.php
  138. +105 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/SubtreeIn.php
  139. +90 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/UserMetadataIn.php
  140. +89 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitor/Visibility.php
  141. +103 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/CriterionVisitorDispatcher.php
  142. +39 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Document.php
  143. +86 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Extractor.php
  144. +75 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Extractor/Loading.php
  145. +74 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FacetBuilderVisitor.php
  146. +123 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FacetBuilderVisitor/Aggregate.php
  147. +82 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FacetBuilderVisitor/ContentType.php
  148. +82 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FacetBuilderVisitor/Section.php
  149. +82 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FacetBuilderVisitor/User.php
  150. +182 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldMap.php
  151. +94 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldNameGenerator.php
  152. +36 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper.php
  153. +88 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/Aggregate.php
  154. +44 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/BooleanMapper.php
  155. +63 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/DateMapper.php
  156. +44 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/DocumentMapper.php
  157. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/GeoLocationMapper.php
  158. +57 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/IdentifierMapper.php
  159. +44 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/IntegerMapper.php
  160. +51 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/MultipleBooleanMapper.php
  161. +51 −0 ...blish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/MultipleIdentifierMapper.php
  162. +50 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/MultipleStringMapper.php
  163. +44 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/PriceMapper.php
  164. +60 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/FieldValueMapper/StringMapper.php
  165. +81 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway.php
  166. +29 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway/HttpClient.php
  167. +25 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway/HttpClient/ConnectionException.php
  168. +174 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway/HttpClient/Stream.php
  169. +42 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway/Message.php
  170. +310 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Gateway/Native.php
  171. +295 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Handler.php
  172. +55 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ContentIdIn.php
  173. +68 −0 .../Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ContentTypeGroupIdIn.php
  174. +68 −0 ...blish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ContentTypeIdIn.php
  175. +92 −0 ...re/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ContentTypeIdentifierIn.php
  176. +77 −0 ...re/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/DateMetadata/ModifiedIn.php
  177. +63 −0 ...Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/DateMetadata/ModifiedRange.php
  178. +77 −0 ...e/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/DateMetadata/PublishedIn.php
  179. +63 −0 ...ersistence/Elasticsearch/Content/Search/Location/CriterionVisitor/DateMetadata/PublishedRange.php
  180. +128 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/LanguageCodeIn.php
  181. +57 −0 ...lish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Location/DepthIn.php
  182. +63 −0 ...h/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Location/DepthRange.php
  183. +51 −0 ...re/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Location/IsMainLocation.php
  184. +57 −0 ...h/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Location/PriorityIn.php
  185. +63 −0 ...ore/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Location/PriorityRange.php
  186. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/LocationIdIn.php
  187. +68 −0 ...sh/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/LocationRemoteIdIn.php
  188. +66 −0 ...blish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ObjectStateIdIn.php
  189. +68 −0 ...sh/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/ParentLocationIdIn.php
  190. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/RemoteIdIn.php
  191. +68 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/SectionIdIn.php
  192. +95 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/SubtreeIn.php
  193. +90 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/UserMetadataIn.php
  194. +50 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/CriterionVisitor/Visibility.php
  195. +176 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/Handler.php
  196. +88 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Aggregate.php
  197. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/ContentId.php
  198. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/ContentName.php
  199. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/DateModified.php
  200. +47 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/DatePublished.php
  201. +47 −0 ...blish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/Depth.php
  202. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/Id.php
  203. +47 −0 ...e/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/IsMainLocation.php
  204. +47 −0 ...ublish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/Path.php
  205. +47 −0 ...sh/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/Priority.php
  206. +47 −0 .../Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/Location/Visibility.php
  207. +47 −0 ...sh/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/SectionIdentifier.php
  208. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Location/SortClauseVisitor/SectionName.php
  209. +539 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Mapper.php
  210. +6 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Resources/elasticsearch.yml
  211. +110 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Resources/mappings/content.json
  212. +35 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Resources/mappings/location.json
  213. +133 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Serializer.php
  214. +48 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor.php
  215. +88 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/Aggregate.php
  216. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/ContentId.php
  217. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/ContentName.php
  218. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/DateModified.php
  219. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/DatePublished.php
  220. +72 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/Field/Field.php
  221. +82 −0 ...ish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/Field/MapLocationDistance.php
  222. +78 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/FieldBase.php
  223. +52 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/LocationDepth.php
  224. +52 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/LocationPathString.php
  225. +52 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/LocationPriority.php
  226. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/SectionIdentifier.php
  227. +47 −0 eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/SortClauseVisitor/SectionName.php
  228. +7 −0 eZ/Publish/Core/Persistence/Elasticsearch/Slot.php
  229. +45 −0 eZ/Publish/Core/Persistence/Elasticsearch/Slot/CreateLocation.php
  230. +25 −0 eZ/Publish/Core/Persistence/Legacy/Content/Search/Location/Handler.php
  231. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/CopyContent.php
  232. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/CopySubtree.php
  233. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/CreateUser.php
  234. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/CreateUserGroup.php
  235. +4 −0 eZ/Publish/Core/Persistence/Solr/Slot/DeleteContent.php
  236. +2 −1 eZ/Publish/Core/Persistence/Solr/Slot/DeleteLocation.php
  237. +4 −0 eZ/Publish/Core/Persistence/Solr/Slot/HideLocation.php
  238. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/MoveSubtree.php
  239. +7 −0 eZ/Publish/Core/Persistence/Solr/Slot/MoveUserGroup.php
  240. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/PublishVersion.php
  241. +4 −0 eZ/Publish/Core/Persistence/Solr/Slot/Recover.php
  242. +6 −0 eZ/Publish/Core/Persistence/Solr/Slot/SetContentState.php
  243. +1 −0 eZ/Publish/Core/Persistence/Solr/Slot/Trash.php
  244. +4 −0 eZ/Publish/Core/Persistence/Solr/Slot/UnhideLocation.php
  245. +1 −0 eZ/Publish/Core/settings/containerBuilder.php
  246. +37 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/criterion_visitors_common.yml
  247. +168 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/criterion_visitors_content.yml
  248. +154 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/criterion_visitors_location.yml
  249. +26 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/facet_builder_visitors.yml
  250. +68 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/field_value_mappers.yml
  251. +24 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/services.yml
  252. +81 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/sort_clause_visitors_content.yml
  253. +82 −0 eZ/Publish/Core/settings/storage_engines/elasticsearch/sort_clause_visitors_location.yml
  254. +123 −0 eZ/Publish/Core/settings/storage_engines/legacy_elasticsearch.yml
  255. +7 −0 eZ/Publish/Core/settings/storage_engines/solr/slots.yml
  256. +15 −0 eZ/Publish/Core/settings/tests/integration_legacy_elasticsearch.yml
  257. +22 −0 eZ/Publish/SPI/Persistence/Content/Location/Search/Handler.php
  258. +25 −0 eZ/Publish/SPI/Persistence/Content/Search/FieldType/DocumentField.php
  259. +67 −0 phpunit-integration-legacy-elasticsearch.xml
@@ -19,6 +19,7 @@ env:
- TEST_CONFIG="phpunit-integration-legacy.xml" DB="postgresql" DATABASE="pgsql://postgres@localhost/$DB_NAME" SYMFONY_VERSION="2.3.*"
- TEST_CONFIG="phpunit-integration-legacy.xml" DB="mysql" DATABASE="mysql://root@localhost/$DB_NAME" SYMFONY_VERSION="2.3.*"
- SOLR_VERSION="4.7.2" TEST_CONFIG="phpunit-integration-legacy-solr.xml" SYMFONY_VERSION="2.3.*"
- ELASTICSEARCH_VERSION="1.4.0.Beta1" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml" SYMFONY_VERSION="2.3.*"

matrix:
allow_failures:
@@ -36,6 +37,8 @@ matrix:
env: TEST_CONFIG="phpunit-integration-legacy.xml" DB="mysql" DATABASE="mysql://root@localhost/$DB_NAME" SYMFONY_VERSION="2.3.*"
- php: 5.4
env: SOLR_VERSION="4.7.2" TEST_CONFIG="phpunit-integration-legacy-solr.xml" SYMFONY_VERSION="2.3.*"
- php: 5.4
env: ELASTICSEARCH_VERSION="1.4.0.Beta1" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml" SYMFONY_VERSION="2.3.*"
# 5.5 run: unit test (Symfony 2.3) + mysql integration test + solr 4.x integration test
- php: 5.5
env: TEST_CONFIG="phpunit.xml"
@@ -52,6 +55,8 @@ matrix:
env: TEST_CONFIG="phpunit-integration-legacy.xml" DB="mysql" DATABASE="mysql://root@localhost/$DB_NAME" SYMFONY_VERSION="2.3.*"
- php: 5.6
env: SOLR_VERSION="4.7.2" TEST_CONFIG="phpunit-integration-legacy-solr.xml" SYMFONY_VERSION="2.3.*"
- php: 5.6
env: ELASTICSEARCH_VERSION="1.4.0.Beta1" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml" SYMFONY_VERSION="2.3.*"
# hhvm run: unit test + sqlite integration test
- php: hhvm
env: TEST_CONFIG="phpunit.xml" SYMFONY_VERSION="2.3.*"
@@ -61,6 +66,8 @@ matrix:
env: TEST_CONFIG="phpunit-integration-legacy.xml" DB="mysql" DATABASE="mysql://root@localhost/$DB_NAME" SYMFONY_VERSION="2.3.*"
- php: hhvm
env: SOLR_VERSION="4.7.2" TEST_CONFIG="phpunit-integration-legacy-solr.xml" SYMFONY_VERSION="2.3.*"
- php: hhvm
env: ELASTICSEARCH_VERSION="1.4.0.Beta1" TEST_CONFIG="phpunit-integration-legacy-elasticsearch.xml" SYMFONY_VERSION="2.3.*"

# test only master (+ Pull requests)
branches:
@@ -74,6 +81,7 @@ before_script:
- ./composer_install_github_key.sh
- if [ $SYMFONY_VERSION != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi;
- composer install --dev --prefer-source
- if [ "$TEST_CONFIG" == "phpunit-integration-legacy-elasticsearch.xml" ] ; then ./bin/.travis/init_elasticsearch.sh ; fi
- "if [ \"$TEST_CONFIG\" = \"phpunit-integration-legacy-solr.xml\" ] ; then curl -L https://raw.github.com/moliware/travis-solr/797595/travis-solr.sh | SOLR_CONFS=eZ/Publish/Core/Persistence/Solr/Content/Search/schema.xml bash ; fi"
# Detecting timezone issues by testing on random timezone
- TEST_TIMEZONES=("America/New_York" "Asia/Calcutta" "UTC")
@@ -0,0 +1,65 @@
#!/bin/sh

download() {
echo "Downloading Elasticsearch from $1..."
curl -s $1 | tar xz
echo "Downloaded"
}

is_elasticsearch_up(){
http_code=`echo $(curl -s -o /dev/null -w "%{http_code}" "http://localhost:9200")`
return `test $http_code = "200"`
}

wait_for_elasticsearch(){
while ! is_elasticsearch_up; do
sleep 3
done
}

run() {
echo "Starting Elasticsearch..."
cd $1/bin
if [ $DEBUG ]
then
./elasticsearch
else
./elasticsearch > /dev/null 2>&1 &
fi
wait_for_elasticsearch
sleep 60
cd ../../
echo "Started."
}

download_and_run() {
url="http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$1.tar.gz"
dir_name="elasticsearch-$1"
resources_dir="eZ/Publish/Core/Persistence/Elasticsearch/Content/Search/Resources"

download $url

# Configure mappings and index
mkdir $dir_name/config/mappings
mkdir $dir_name/config/mappings/ezpublish
cp $resources_dir/mappings/content.json $dir_name/config/mappings/ezpublish
cp $resources_dir/mappings/location.json $dir_name/config/mappings/ezpublish
rm $dir_name/config/elasticsearch.yml
cp $resources_dir/elasticsearch.yml $dir_name/config

# Run elasticsearch
run $dir_name
}

check_version() {
case $1 in
1.2.2|1.2.3|1.3.0|1.3.1|1.3.2|1.3.3|1.3.4|1.4.0.Beta1);;
*)
echo "Sorry, $1 is not supported or not valid version."
exit 1
;;
esac
}

check_version $ELASTICSEARCH_VERSION
download_and_run $ELASTICSEARCH_VERSION
@@ -0,0 +1,117 @@
# Elasticsearch Storage Engine implementation

This document provides overview of the implementation of the Elasticsearch Storage Engine.

Elasticsearch Storage Engine implements SPI Content and Location search handler interfaces.
The rest of the interfaces are used from Legacy Storage Engine implementation. This is the same
as Solr storage engine is implemented, and will change with extracting SPI Search API out of
Persistence into its own SPI namespace. That will enable usage of Persistence Cache layer and
re-usage of common implementation, like field map and indexing slots.

## Motivation

Implementing:

1. Indexing, analyzing, sorting on and querying Field data
2. Location search

## Data structure

Content and Location objects are indexed as different document types. This was necessary in order
to support Location Search, since it can not be fully supported by denormalizing Location data into
a Content document.

Possible future implementation of direct search for nested documents would make indexing Content
and Locations unnecessary. Though this seems to be technically possible, it is not planned at the
moment (see discussion on https://github.com/elasticsearch/elasticsearch/issues/3022 for more info).

### Content document

Content documents contain their Locations and fields (per translation) as nested documents.
In Elasticsearch implementation of Lucene nested documents these do not exist outside of the parent
document context. This means it is not possible to independently search for them and return them as a
result of the search.

For the outline of the nested document feature see: http://www.slideshare.net/MarkHarwood/proposal-for-nested-document-support-in-lucene

Locations as nested documents of Content enable future implementation of e.g. LocationQuery
criterion that would combine Location conditions, which would make queries like "find all Content with
visible Location in this subtree" possible.

Fields as nested documents enable targeting only specific translations in search and with that also easier
implementation of language analysis per translation.

### Location document

Since Location always has exactly one Content, it's document does not contain nested documents.
Instead, Content data is denormalized into a Location document. Fields data is not indexed as a part
of Location document, doing so would have some drawbacks:

* Index size would significantly increase as the same Field data would have to be indexed once per
Content and additionally once for each of its Locations
* Multiple Locations of a Content would mess up scoring as the same Field data would be indexed
for each Location of a single Content

For these reasons Field and FullText criterion support with Location Search is not implemented here
and is still a subject for discussion. There are no technical problems what would prevent implementation
though, this can actually be done quite easily by reusing what is already implemented for Content Search.

## Implementation

Elasticsearch cluster is communicated with over its REST API. For this simple HTTP client is
used (it is actually copied from Solr Storage engine implementation).

### Gateway

Same Gateway implementation (with different dependencies) is used by both Content and Location search
handlers.

### Mapping (schema)

Mapping for Content and Location documents can be found in `Persistence/Elasticsearch/Resources/mappings`.
Dynamic mapping is available only for nested Field documents, otherwise types of fields are known and
are mapped statically.

### Mapper

Mapper service is used to create a Document object for a Content or Location. Mapping in a dedicated
service enables alternative implementations, for example a custom user implementation could index
Content fields as a part of a Location. This would of course need to be accompanied by a custom mapping
and implementation of Field and FullText criterion visitors for Location Search.

Other custom implementation could skip indexing Content if Content Search is not needed and so on.

### Document object

Document represents a document to be indexed by Elasticsearch index engine. It is described by:

1. id (Content or Location id)
2. type (Content or Location)
3. fields (document's fields, can contain other nested Documents in form of SPI DocumentField)

### Serializer

Serializer is a simple service used to convert a Document to a JSON string that can be passed over
Elasticsearch REST API.

### Criterion visiting

Elasticsearch Query DSL actually describes abstract syntax tree of queries/filters, which is very similar
to the structure of our criteria. Criterion visitors return simple hash structures that appropriately
describe parts of this AST. End result of criterion visiting can be JSON encoded to produce valid
Elasticsearch query that can be passed over the REST API.

#### Query and filter context

Query DSL uses different syntax for queries and filters, but often queries and filters are similar and
even the same. To cover for this, same criterion visitors are dispatched with query/filter context.

Elasticsearch aggregations (facets in Solr speak) work only in query context. For this reason filters
are applied as "filter" part of main "filtered" query.

### Extractor

Extractor is used by search handlers to extract search result from the data returned from Elasticsearch index.
Currently only `Loading` extractor is implemented, which returns search hits (Location and ContentInfo) by
loading them using the storage implementation. Alternative implementation could do the same by
reconstructing them from the returned Elasticsearch data.
@@ -0,0 +1,165 @@
<?php
/**
* File containing the ElasticsearchCreateIndexCommand class.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
*/
namespace eZ\Bundle\EzPublishElasticsearchBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use PDO;
class ElasticsearchCreateIndexCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName( 'ezpublish:elasticsearch_create_index' )
->setDescription( 'Indexes the configured database in configured Elasticsearch index' )
->addArgument( "bulk_count", InputArgument::OPTIONAL, "Number of Content objects indexed at once", 5 )
->setHelp(
<<<EOT
The command <info>%command.name%</info> indexes current configured database in configured Elasticsearch index.
EOT
);
}
protected function execute( InputInterface $input, OutputInterface $output )
{
$bulkCount = $input->getArgument( 'bulk_count' );
/** @var \eZ\Publish\SPI\Persistence\Handler $persistenceHandler */
$persistenceHandler = $this->getContainer()->get( 'ezpublish.api.persistence_handler' );
/** @var \eZ\Publish\Core\Persistence\Database\DatabaseHandler $databaseHandler */
$databaseHandler = $this->getContainer()->get( 'ezpublish.connection' );
// Indexing Content
$query = $databaseHandler
->createSelectQuery()
->select( "count(id)" )
->from( 'ezcontentobject' );
$stmt = $query->prepare();
$stmt->execute();
$totalCount = $stmt->fetchColumn();
$query = $databaseHandler
->createSelectQuery()
->select( 'id', 'current_version' )
->from( 'ezcontentobject' );
$stmt = $query->prepare();
$stmt->execute();
/** @var \eZ\Publish\Core\Persistence\Elasticsearch\Content\Search\Handler $searchHandler */
$searchHandler = $persistenceHandler->searchHandler();
$searchHandler->setCommit( false );
$searchHandler->purgeIndex();
$searchHandler->setCommit( true );
$output->writeln( "Indexing Content..." );
/** @var \Symfony\Component\Console\Helper\ProgressHelper $progress */
$progress = $this->getHelperSet()->get( 'progress' );
$progress->start( $output, $totalCount );
$i = 0;
do
{
$contentObjects = array();
for ( $k = 0; $k <= $bulkCount; $k++ )
{
if ( !$row = $stmt->fetch( PDO::FETCH_ASSOC ) )
{
break;
}
$contentObjects[] = $persistenceHandler->contentHandler()->load(
$row['id'],
$row['current_version']
);
}
if ( !empty( $contentObjects ) )
{
$searchHandler->bulkIndexContent( $contentObjects );
}
$progress->advance( $k );
}
while ( ( $i += $bulkCount ) < $totalCount );
$progress->finish();
// Indexing Locations
$query = $databaseHandler->createSelectQuery();
$query
->select( "count(node_id)" )
->from( 'ezcontentobject_tree' )
->where(
$query->expr->neq(
$databaseHandler->quoteColumn( "contentobject_id" ),
$query->bindValue( 0, null, PDO::PARAM_INT )
)
);
$stmt = $query->prepare();
$stmt->execute();
$totalCount = $stmt->fetchColumn();
$query = $databaseHandler->createSelectQuery();
$query
->select( 'node_id' )
->from( 'ezcontentobject_tree' )
->where(
$query->expr->neq(
$databaseHandler->quoteColumn( "contentobject_id" ),
$query->bindValue( 0, null, PDO::PARAM_INT )
)
);
$stmt = $query->prepare();
$stmt->execute();
/** @var \eZ\Publish\Core\Persistence\Elasticsearch\Content\Search\Location\Handler $searchHandler */
$searchHandler = $persistenceHandler->locationSearchHandler();
$searchHandler->setCommit( false );
$searchHandler->purgeIndex();
$searchHandler->setCommit( true );
$output->writeln( "Indexing Locations..." );
/** @var \Symfony\Component\Console\Helper\ProgressHelper $progress */
$progress = $this->getHelperSet()->get( 'progress' );
$progress->start( $output, $totalCount );
$i = 0;
do
{
$locations = array();
for ( $k = 0; $k <= $bulkCount; $k++ )
{
if ( !$row = $stmt->fetch( PDO::FETCH_ASSOC ) )
{
break;
}
$locations[] = $persistenceHandler->locationHandler()->load( $row['node_id'] );
}
if ( !empty( $locations ) )
{
$searchHandler->bulkIndexLocations( $locations );
}
$progress->advance( $k );
}
while ( ( $i += $bulkCount ) < $totalCount );
$progress->finish();
}
}
Oops, something went wrong.

0 comments on commit 5d0924f

Please sign in to comment.