Skip to content

Commit 096a5cb

Browse files
committed
!!! TASK: Remove default autocomplete setup
This removes the default addition of the AutocompletableMixin and the SuggestableMixin from the package, as well as the analyzer setup done in the settings. Instead the README is amended with instructions on how to use this. This avoids errors when using a custom index name.
1 parent b61bb0a commit 096a5cb

3 files changed

Lines changed: 44 additions & 57 deletions

File tree

Configuration/NodeTypes.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,3 @@
44
ui:
55
label: 'Search'
66
icon: 'icon-search'
7-
8-
'Neos.Neos:Document':
9-
superTypes:
10-
'Flowpack.SearchPlugin:SuggestableMixin': true
11-
'Flowpack.SearchPlugin:AutocompletableMixin': true
12-
13-
'Neos.Neos:Shortcut':
14-
superTypes:
15-
'Flowpack.SearchPlugin:SuggestableMixin': false
16-
'Flowpack.SearchPlugin:AutocompletableMixin': false
17-
18-
'Neos.NodeTypes:TitleMixin':
19-
superTypes:
20-
'Flowpack.SearchPlugin:SuggestableMixin': true
21-
'Flowpack.SearchPlugin:AutocompletableMixin': true

Configuration/Settings.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,3 @@ Neos:
1515
Search:
1616
defaultContext:
1717
Flowpack.SearchPlugin.Suggestion: Flowpack\SearchPlugin\EelHelper\SuggestionIndexHelper
18-
19-
Flowpack:
20-
ElasticSearch:
21-
indexes:
22-
default:
23-
typo3cr:
24-
analysis:
25-
filter:
26-
autocompleteFilter:
27-
max_shingle_size: 5
28-
min_shingle_size: 2
29-
type: 'shingle'
30-
analyzer:
31-
autocomplete:
32-
filter: [ 'lowercase', 'autocompleteFilter' ]
33-
char_filter: [ 'html_strip' ]
34-
type: 'custom'
35-
tokenizer: 'standard'

README.md

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,6 @@ To specify a custom index name, the following is needed:
3333
Search:
3434
elasticSearch:
3535
indexName: acmecom
36-
37-
Flowpack:
38-
ElasticSearch:
39-
indexes:
40-
default: # client name used to connect (see Flowpack.ElasticSearch.clients)
41-
acmecom: # custom index name
42-
analysis:
43-
filter:
44-
autocompleteFilter:
45-
max_shingle_size: 5
46-
min_shingle_size: 2
47-
type: 'shingle'
48-
analyzer:
49-
autocomplete:
50-
filter: [ 'lowercase', 'autocompleteFilter' ]
51-
char_filter: [ 'html_strip' ]
52-
type: 'custom'
53-
tokenizer: 'standard'
54-
55-
The latter is the custom analysis configuration used by the completion / suggestion and must be
56-
repeated for a custom index name.
5736

5837
### Pagination
5938

@@ -80,9 +59,50 @@ Feel free to use the `DocumentSearchResult.html` in the Flowpack.SearchPlugin as
8059
## Search completions and suggestions
8160

8261
The default search form template comes with a `data-autocomplete-source` attribute pointing to the
83-
`SuggestController` of this package. Fed with a `term` parameter via a `GET` request, it returns a
84-
JSON-encoded array of suggestions from Elasticsearch. These are fetched with a term suggester from
85-
the `_all` field, i.e. "the fulltext index".
62+
`SuggestController` of this package.
63+
64+
To use this term suggester, you need to configure the indexing like this, to define a custom
65+
analyzer to be used:
66+
67+
Flowpack:
68+
ElasticSearch:
69+
indexes:
70+
default: # client name used to connect (see Flowpack.ElasticSearch.clients)
71+
acmecom: # your (custom) index name
72+
analysis:
73+
filter:
74+
autocompleteFilter:
75+
max_shingle_size: 5
76+
min_shingle_size: 2
77+
type: 'shingle'
78+
analyzer:
79+
autocomplete:
80+
filter: [ 'lowercase', 'autocompleteFilter' ]
81+
char_filter: [ 'html_strip' ]
82+
type: 'custom'
83+
tokenizer: 'standard'
84+
85+
Then you need to configure the node types to be be included in the suggestion building, this can be
86+
done like this:
87+
88+
'Neos.Neos:Document':
89+
superTypes:
90+
'Flowpack.SearchPlugin:SuggestableMixin': true
91+
'Flowpack.SearchPlugin:AutocompletableMixin': true
92+
93+
'Neos.Neos:Shortcut':
94+
superTypes:
95+
'Flowpack.SearchPlugin:SuggestableMixin': false
96+
'Flowpack.SearchPlugin:AutocompletableMixin': false
97+
98+
'Neos.NodeTypes:TitleMixin':
99+
superTypes:
100+
'Flowpack.SearchPlugin:SuggestableMixin': true
101+
'Flowpack.SearchPlugin:AutocompletableMixin': true
102+
103+
When fed with a `term` parameter via a `GET` request, the `SuggestController` will return a
104+
JSON-encoded array of suggestions from Elasticsearch. They are fetched with a term suggester
105+
from the `_all` field, i.e. "the fulltext index".
86106

87107
These can be used to provide autocompletion on the search input using a JS library of your choice.
88108
In case you need to build the URI to the suggest controller yourself, this is what the form uses:

0 commit comments

Comments
 (0)