Skip to content

Commit 93d09d5

Browse files
committed
TASK: Some more documentation tweaks
1 parent 1f56a45 commit 93d09d5

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ Furthermore, the following operators are supported:
212212
* `greaterThanOrEqual('propertyName', value)` -- range filter with property values greater than or equal to the given value
213213
* `lessThan('propertyName', value)` -- range filter with property values less than the given value
214214
* `lessThanOrEqual('propertyName', value)` -- range filter with property values less than or equal to the given value
215-
* `sortAsc('propertyName')` and `sortDesc('propertyName')` -- can also be used multiple times, e.g. `sortAsc('tag').sortDesc(`date')` will first sort by tag ascending, and then by date descending.
215+
* `sortAsc('propertyName')` and `sortDesc('propertyName')` -- can also be used multiple times, e.g. `sortAsc('tag').sortDesc(`date')`
216+
will first sort by tag ascending, and then by date descending.
216217
* `limit(5)` -- only return five results. If not specified, the default limit by Elasticsearch applies (which is at 10 by default)
217218
* `from(5)` -- return the results starting from the 6th one
218219
* `fulltext(...)` -- do a query_string query on the Fulltext Index
@@ -257,7 +258,7 @@ prototype(Acme.Blog:SingleTag) < prototype(TYPO3.Neos:Template) {
257258

258259
#### Making OR queries
259260

260-
There's no OR operator provided in this package, so we would need to use custom ElasticSearch query filter for that:
261+
There's no OR operator provided in this package, so you need to use a custom Elasticsearch query filter for that:
261262

262263
```
263264
....queryFilter('bool', {should: [
@@ -284,7 +285,9 @@ You can nest aggregations by providing a parent name.
284285

285286

286287
### Examples
288+
287289
#### Add a average aggregation
290+
288291
To add an average aggregation you can use the fieldBasedAggregation. This snippet would add an average aggregation for
289292
a property price:
290293
```
@@ -296,6 +299,7 @@ Now you can access your aggregations inside your fluid template with
296299
```
297300

298301
#### Create a nested aggregation
302+
299303
In this scenario you could have a node that represents a product with the properties price and color. If you would like
300304
to know the average price for all your colors you just nest an aggregation in your TypoScript:
301305
```
@@ -311,6 +315,7 @@ fieldBasedAggregation("anotherAggregation", "field", "avg", "colors.avgprice")
311315
```
312316

313317
#### Add a custom aggregation
318+
314319
To add a custom aggregation you can use the `aggregation()` method. All you have to do is to provide an array with your
315320
aggregation definition. This example would do the same as the fieldBasedAggregation would do for you:
316321
```
@@ -323,6 +328,7 @@ nodes = ${Search.query(site)...aggregation("color", this.aggregationDefinition).
323328
```
324329

325330
#### Product filter
331+
326332
This is a more complex scenario. With this snippet we will create a full product filter based on your selected Nodes. Imagine
327333
an NodeTye ProductList with an property `products`. This property contains a comma separated list of sku's. This could also
328334
be a reference on other products.
@@ -385,7 +391,7 @@ for all your filterable properties, or else filtering won't work on them properl
385391

386392
## Sorting
387393

388-
This package adapts ElasticSearchs sorting capabilities. You can add multiple sort operations to your query.
394+
This package adapts Elasticsearchs sorting capabilities. You can add multiple sort operations to your query.
389395
Right now there are three methods you can use:
390396

391397
* `sortAsc('propertyName')`
@@ -394,13 +400,16 @@ Right now there are three methods you can use:
394400

395401
Just append those method to your query like this:
396402
```
397-
# sort ascending by property title
403+
# Sort ascending by property title
404+
398405
nodes = ${q(Search.query(site).....sortAsc("title").execute())}
399406
400-
# sort for multiple properties
407+
# Sort for multiple properties
408+
401409
nodes = ${q(Search.query(site).....sortAsc("title").sortDesc("name").execute())}
402410
403-
# custom sort opertation
411+
# Custom sort operation
412+
404413
geoSorting = TYPO3.TypoScript:RawArray {
405414
_geo_distance = TYPO3.TypoScript:RawArray {
406415
latlng = TYPO3.TypoScript:RawArray {
@@ -419,6 +428,7 @@ Check https://www.elastic.co/guide/en/elasticsearch/reference/current/search-req
419428
options.
420429

421430
### Example with pagination and sort by distance
431+
422432
This is how a more complex example could look like. Imagine you a want to render a list of nodes and in addition to each
423433
node you want to display the distance to a specific point.
424434

@@ -466,6 +476,7 @@ The ViewHelper will use \TYPO3\Flow\Utility\Arrays::getValueByPath() to return a
466476
of an array or a string. Check the documentation \TYPO3\Flow\Utility\Arrays::getValueByPath() for more informations.
467477

468478
**Important notice**
479+
469480
The ViewHelper GetHitArrayForNode will return the raw hit result array. The path poperty allows you to access some
470481
specific data like the the sort data. If there is only one value for your path the value will be returned.
471482
If there is more data the full array will be returned by GetHitArrayForNode-VH. So you might have to use the
@@ -501,26 +512,30 @@ Elasticsearch offers an easy way to get query suggestions based on your query. C
501512
you can build and use suggestion in your search.
502513

503514
**Suggestion methods implemented**
504-
There are two methods implemented. `suggestions` is a generic one that allows to build the suggestion query of your
505-
dreams. The other method is `termSuggestions` and is meant for basic term suggestions. They can be added to your totaly
515+
516+
There are two methods implemented. `suggestions` is a generic one that allows to build the suggestion query of your
517+
dreams. The other method is `termSuggestions` and is meant for basic term suggestions. They can be added to your totaly
506518
awesome TS search query.
507-
519+
508520
* `suggestions($name, array $suggestionDefinition)` -- generic method to be filled with your own suggestionQuery
509521
* `termSuggestions($term, $field = '_all', $name = 'suggestions'` -- simple term suggestion query on all fields
510522

511523
### Examples
524+
512525
#### Add a simple suggestion to a query
526+
513527
Simple suggestion that returns a suggestion based on the sent term
514528

515529
```
516530
suggestions = $(Search.query(site)...termSuggestions('someTerm')}
517531
```
518-
You can access your suggestions inside your fluid template with
532+
You can access your suggestions inside your fluid template with
519533
```
520534
{nodes.suggestions}
521535
```
522536

523537
### Add a custom suggestion
538+
524539
Phrase query that returns query suggestions
525540

526541
```
@@ -541,7 +556,8 @@ suggestions = ${Search.query(site)...suggestions('my_suggestions', this.suggesti
541556

542557
## Advanced: Configuration of Indexing
543558

544-
**The default configuration supports most usecases and often may not need to be touched, as this package comes with sane defaults for all Neos data types**
559+
**The default configuration supports most usecases and often may not need to be touched, as this package comes
560+
with sane defaults for all Neos data types.**
545561

546562
Indexing of properties is configured at two places. The defaults per-data-type are configured
547563
inside `TYPO3.TYPO3CR.Search.defaultConfigurationPerType` of `Settings.yaml`.
@@ -587,7 +603,8 @@ TYPO3:
587603
indexing: '${(node.hiddenBeforeDateTime ? Date.format(node.hiddenBeforeDateTime, "Y-m-d\TH:i:sP") : null)}'
588604
```
589605

590-
If your nodetypes schema defines custom properties of type DateTime, you have got to provide similar configuration for them as well in your NodeTypes.yaml, or else they will not be indexed correctly.
606+
If your nodetypes schema defines custom properties of type DateTime, you have got to provide similar configuration for
607+
them as well in your `NodeTypes.yaml`, or else they will not be indexed correctly.
591608

592609
There are a few indexing helpers inside the `Indexing` namespace which are usable inside the
593610
`indexing` expression. In most cases, you don't need to touch this, but they were needed to build up

0 commit comments

Comments
 (0)