Skip to content

Commit d79c138

Browse files
ComiRkdambekalns
authored andcommitted
TASK: Update travis.yml, remove "typo3", declare dependencies
1 parent a3872e1 commit d79c138

11 files changed

Lines changed: 97 additions & 89 deletions

File tree

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ matrix:
55
env: ES=1
66
- php: 7.0
77
env: ES=2
8+
- php: 7.1
9+
env: ES=1
10+
- php: 7.1
11+
env: ES=2
812
sudo: false
913
before_install:
1014
- export NEOS_TARGET_VERSION=3.0

Classes/Command/NodeTypeCommandController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Provides CLI features for debugging the node types.
1919
*
20-
* TODO: move to TYPO3CR or Neos
20+
* TODO: move to ContentRepository or Neos
2121
*
2222
* @Flow\Scope("singleton")
2323
*/

Classes/ElasticSearchClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class ElasticSearchClient extends \Flowpack\ElasticSearch\Domain\Model\Client
2828
{
2929
/**
30-
* The index name to be used for querying (by default "typo3cr")
30+
* The index name to be used for querying (by default "neoscr")
3131
*
3232
* @var string
3333
*/

Classes/Mapping/NodeTypeMappingBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
2121

2222
/**
23-
* Builds the mapping information for TYPO3CR Node Types in Elastic Search
23+
* Builds the mapping information for ContentRepository Node Types in Elastic Search
2424
*
2525
* @Flow\Scope("singleton")
2626
*/
@@ -64,7 +64,7 @@ public function initializeObject($cause)
6464
}
6565

6666
/**
67-
* Converts a TYPO3CR Node Type name into a name which can be used for an Elastic Search Mapping
67+
* Converts a ContentRepository Node Type name into a name which can be used for an Elastic Search Mapping
6868
*
6969
* @param string $nodeTypeName
7070
* @return string

Classes/Service/IndexWorkspaceTrait.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service;
33

4-
/* *
5-
* This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6-
* *
7-
* It is free software; you can redistribute it and/or modify it under *
8-
* the terms of the GNU Lesser General Public License, either version 3 *
9-
* of the License, or (at your option) any later version. *
10-
* *
11-
* The TYPO3 project - inspiring people to share! *
12-
* */
4+
/*
5+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
6+
*
7+
* (c) Contributors of the Neos Project - www.neos.io
8+
*
9+
* This package is Open Source Software. For the full copyright and license
10+
* information, please view the LICENSE file which was distributed with this
11+
* source code.
12+
*/
1313

1414
use Neos\Flow\Annotations as Flow;
1515
use Neos\ContentRepository\Domain\Model\NodeInterface;

Configuration/NodeTypes.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
21
'Neos.Neos:Node': &node
32
search:
43
fulltext:
54
enable: true
6-
75
properties:
8-
96
'__identifier':
107
search:
118
elasticSearchMapping:

Configuration/Settings.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,18 @@ Flowpack:
106106
Neos:
107107
ContentRepository:
108108
Search:
109+
# API. If set to FALSE, only index the "live" workspace and not user workspaces.
110+
# If you only index the live workspace, Search will not work for your editors in the user workspaces.
111+
# Furthermore, if you heavily rely on Search for collecting content, this might be strange for editors to
112+
# work with -- as unpublished changes are not indexed right away.
109113
indexAllWorkspaces: true
114+
110115
elasticSearch:
111-
indexName: typo3cr
116+
117+
# API. name of the ElasticSearch index to use. Will create many indices prefixed by this indexName.
118+
indexName: neoscr
119+
120+
# configuration of the ElasticSearch logfile
112121
log:
113122
backendOptions:
114123
fileBackend:
@@ -118,8 +127,10 @@ Neos:
118127
maximumLogFileSize: 10485760
119128
logFilesToKeep: 1
120129
logMessageOrigin: false
130+
121131
ansiConsoleBackend:
122132
disableAnsi: false
133+
123134
defaultConfigurationPerType:
124135
string:
125136
elasticSearchMapping:
@@ -137,19 +148,20 @@ Neos:
137148
format: date_time_no_millis
138149
include_in_all: false
139150
Neos\Media\Domain\Model\Asset:
140-
elasticSearchMapping: ''
151+
elasticSearchMapping: '' # deliberately don't map or index this
141152
array<Neos\Media\Domain\Model\Asset>:
142-
elasticSearchMapping: ''
153+
elasticSearchMapping: '' # deliberately don't map or index this
143154
Neos\Media\Domain\Model\ImageInterface:
144-
elasticSearchMapping: ''
155+
elasticSearchMapping: '' # deliberately don't map or index this
145156
references:
146157
elasticSearchMapping:
147-
type: string
158+
type: string # an array of strings, to be precise
148159
index: not_analyzed
149160
reference:
150161
elasticSearchMapping:
151162
type: string
152163
index: not_analyzed
164+
153165
Fusion:
154166
defaultContext:
155167
SearchResult: Flowpack\ElasticSearch\ContentRepositoryAdaptor\Eel\SearchResultHelper

Configuration/Testing/NodeTypes.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
'Flowpack.ElasticSearch.ContentRepositoryAdaptor:BaseType':
32
superTypes: { }
43
'Flowpack.ElasticSearch.ContentRepositoryAdaptor:Type1':

Configuration/Testing/Settings.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
Neos:
32
ContentRepository:
43
Search:
54
elasticSearch:
6-
indexName: typo3cr_testing
5+
indexName: neoscr_testing
76
log:
87
backendOptions:
98
fileBackend:

README.md

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ _Currently the Driver interfaces is not marked as API, and can be changed to ada
2020

2121
## Relevant Packages
2222

23-
* [Neos.ContentRepository.Search](https://www.neos.io/download-and-extend/packages/typo3/typo3-typo3cr-search.html): provides common functionality for searching Neos Content Repository nodes,
24-
does not contain a search backend
23+
* [Neos.ContentRepository.Search](https://www.neos.io/download-and-extend/packages/neos/neos-content-repository-search.html): provides common functionality for searching Neos Content Repository nodes. Does not contain a search backend.
2524
* [Flowpack.ElasticSearch](https://www.neos.io/download-and-extend/packages/flowpack/flowpack-elasticsearch.html): provides common code for working with Elasticsearch
2625
* [Flowpack.ElasticSearch.ContentRepositoryAdaptor](https://www.neos.io/download-and-extend/packages/flowpack/flowpack-elasticsearch-contentrepositoryadaptor.html): this package
2726
* [Flowpack.SimpleSearch.ContentRepositoryAdaptor](https://www.neos.io/download-and-extend/packages/flowpack/flowpack-simplesearch-contentrepositoryadaptor.html): an alternative search backend (to be used instead of this package); storing the search index in SQLite
@@ -34,15 +33,11 @@ composer require 'flowpack/elasticsearch-contentrepositoryadaptor'
3433
// Not required, but can be used to learn how to integration the flowpack/elasticsearch-contentrepositoryadaptor in your project
3534
composer require 'flowpack/searchplugin'
3635
```
36+
Ensure to update `<your-elasticsearch>/config/elasticsearch.yml` as explained below; then start Elasticsearch.
3737

38-
Now, add the routes as described in the [README of Flowpack.SearchPlugin](https://github.com/Flowpack/Flowpack.SearchPlugin)
39-
as the **first route** in Configuration/Routes.yaml.
38+
Then just run `./flow nodeindex:build` and add the search plugin to your page. It should "just work".
4039

41-
Then, ensure to update `<your-elasticsearch>/config/elasticsearch.yml` as explained below; then start Elasticsearch.
42-
43-
Finally, run `./flow nodeindex:build`, and add the search plugin to your page. It should "just work".
44-
45-
## Elasticsearch Configuration file elasticsearch.yml
40+
## Elasticsearch Configuration file *elasticsearch.yml*
4641

4742
There is a need, depending on your version of Elasticsearch, to add specific configuration to your
4843
Elasticsearch Configuration File `<your-elasticsearch>/config/elasticsearch.yml`.
@@ -78,24 +73,24 @@ Example is from the Documentation of the used *Flowpack.ElasticSearch* Package
7873

7974
https://github.com/Flowpack/Flowpack.ElasticSearch/blob/master/Documentation/Indexer.rst
8075

81-
```
76+
```yaml
8277
Flowpack:
83-
ElasticSearch:
84-
indexes:
85-
default:
86-
'twitter':
87-
analysis:
88-
filter:
89-
elision:
90-
type: 'elision'
91-
articles: [ 'l', 'm', 't', 'qu', 'n', 's', 'j', 'd' ]
92-
analyzer:
93-
custom_french_analyzer:
94-
tokenizer: 'letter'
95-
filter: [ 'asciifolding', 'lowercase', 'french_stem', 'elision', 'stop' ]
96-
tag_analyzer:
97-
tokenizer: 'keyword'
98-
filter: [ 'asciifolding', 'lowercase' ]
78+
ElasticSearch:
79+
indexes:
80+
default:
81+
twitter:
82+
analysis:
83+
filter:
84+
elision:
85+
type: elision
86+
articles: [ 'l', 'm', 't', 'qu', 'n', 's', 'j', 'd' ]
87+
analyzer:
88+
custom_french_analyzer:
89+
tokenizer: letter
90+
filter: [ 'asciifolding', 'lowercase', 'french_stem', 'elision', 'stop' ]
91+
tag_analyzer:
92+
tokenizer: keyword
93+
filter: [ 'asciifolding', 'lowercase' ]
9994
```
10095
10196
If you use multiple client configurations, please change the *default* key just below the *indexes*.
@@ -168,18 +163,18 @@ Fusion setup:
168163
```
169164
# for "Tag" documents, replace the main content area.
170165
prototype(Neos.Neos:PrimaryContent).acmeBlogTag {
171-
condition = ${q(node).is('[instanceof Acme.Blog:Tag]')}
172-
type = 'Acme.Blog:TagPage'
166+
condition = ${q(node).is('[instanceof Acme.Blog:Tag]')}
167+
type = 'Acme.Blog:TagPage'
173168
}
174169
175170
# The "TagPage"
176171
prototype(Acme.Blog:TagPage) < prototype(Neos.Fusion:Collection) {
177-
collection = ${Search.query(site).nodeType('Acme.Blog:Post').exactMatch('tags', node).sortDesc('creationDate').execute()}
178-
itemName = 'node'
179-
itemRenderer = Acme.Blog:SingleTag
172+
collection = ${Search.query(site).nodeType('Acme.Blog:Post').exactMatch('tags', node).sortDesc('creationDate').execute()}
173+
itemName = 'node'
174+
itemRenderer = Acme.Blog:SingleTag
180175
}
181176
prototype(Acme.Blog:SingleTag) < prototype(Neos.Neos:Template) {
182-
...
177+
...
183178
}
184179
```
185180

@@ -189,9 +184,9 @@ There's no OR operator provided in this package, so you need to use a custom Ela
189184

190185
```
191186
....queryFilter('bool', {should: [
192-
{term: {tags: tagNode.identifier}},
193-
{term: {places: tagNode.identifier}},
194-
{term: {projects: tagNode.identifier}}
187+
{term: {tags: tagNode.identifier}},
188+
{term: {places: tagNode.identifier}},
189+
{term: {projects: tagNode.identifier}}
195190
]})
196191
```
197192

@@ -228,7 +223,7 @@ Now you can access your aggregations inside your fluid template with
228223
#### Create a nested aggregation
229224
230225
In this scenario you could have a node that represents a product with the properties price and color. If you would like
231-
to know the average price for all your colors you just nest an aggregation in your TypoScript:
226+
to know the average price for all your colors you just nest an aggregation in your Fusion:
232227
```
233228
nodes = ${Search.query(site)...fieldBasedAggregation("colors", "color").fieldBasedAggregation("avgprice", "price", "avg", "colors").execute()}
234229
```
@@ -247,9 +242,9 @@ To add a custom aggregation you can use the `aggregation()` method. All you have
247242
aggregation definition. This example would do the same as the fieldBasedAggregation would do for you:
248243
```
249244
aggregationDefinition = Neos.Fusion:RawArray {
250-
terms = Neos.Fusion:RawArray {
251-
field = "color"
252-
}
245+
terms = Neos.Fusion:RawArray {
246+
field = "color"
247+
}
253248
}
254249
nodes = ${Search.query(site)...aggregation("color", this.aggregationDefinition).execute()}
255250
```
@@ -264,13 +259,13 @@ be a reference on other products.
264259
prototype(Vendor.Name:FilteredProductList) < prototype(Neos.Neos:Content)
265260
prototype(Vendor.Name:FilteredProductList) {
266261

267-
// Create SearchFilter for products
268-
searchFilter = Neos.Fusion:RawArray {
269-
sku = ${String.split(q(node).property("products"), ",")}
270-
}
262+
// Create SearchFilter for products
263+
searchFilter = Neos.Fusion:RawArray {
264+
sku = ${String.split(q(node).property("products"), ",")}
265+
}
271266

272-
# Search for all products that matches your queryFilter and add aggregations
273-
filter = ${Search.query(site).nodeType("Vendor.Name:Product").queryFilterMultiple(this.searchFilter, "must").fieldBasedAggregation("color", "color").fieldBasedAggregation("size", "size").execute()}
267+
# Search for all products that matches your queryFilter and add aggregations
268+
filter = ${Search.query(site).nodeType("Vendor.Name:Product").queryFilterMultiple(this.searchFilter, "must").fieldBasedAggregation("color", "color").fieldBasedAggregation("size", "size").execute()}
274269

275270
# Add more filter if get/post params are set
276271
searchFilter.color = ${request.arguments.color}
@@ -282,13 +277,13 @@ prototype(Vendor.Name:FilteredProductList) {
282277
products = ${Search.query(site).nodeType("Vendor.Name:Product").queryFilterMultiple(this.searchFilter, "must").execute()}
283278

284279
# don't cache this element
285-
@cache {
286-
mode = 'uncached'
287-
context {
288-
1 = 'node'
289-
2 = 'site'
290-
}
291-
}
280+
@cache {
281+
mode = 'uncached'
282+
context {
283+
1 = 'node'
284+
2 = 'site'
285+
}
286+
}
292287
```
293288
294289
In the first lines we will add a new searchFilter variable and add your selected sku's as a filter. Based on this selection
@@ -370,7 +365,7 @@ First of all you have to define a property in your NodeTypes.yaml for your node
370365
type: "geo_point"
371366
```
372367
373-
Query your nodes in your TypoScript:
368+
Query your nodes in your Fusion:
374369
```
375370
geoSorting = Neos.Fusion:RawArray {
376371
_geo_distance = Neos.Fusion:RawArray {
@@ -389,13 +384,14 @@ nodes = ${Search.query(site).nodeType('Vendor.Name:Retailer').sort(this.geoSorti
389384
Now you can paginate that nodes in your template. To get your actually distance for each node use
390385
the `GetHitArrayForNodeViewHelper`:
391386
```
387+
{namespace cr=Neos\ContentRepository\ViewHelpers}
392388
{namespace es=Flowpack\ElasticSearch\ContentRepositoryAdaptor\ViewHelpers}
393389

394-
<typo3cr:widget.paginate query="{nodes}" as="paginatedNodes">
390+
<cr:widget.paginate query="{nodes}" as="paginatedNodes">
395391
<f:for each="{paginatedNodes}" as="singleNode">
396392
{singleNode.name} - <es:getHitArrayForNode queryResultObject="{nodes}" node="{singleNode}" path="sort.0" />
397393
</f:for>
398-
</typo3cr:widget.paginate>
394+
</cr:widget.paginate>
399395

400396
```
401397

0 commit comments

Comments
 (0)