11# Flowpack.SearchPlugin
22
33This plugin is a Search Plugin, to be used together with
4+
45* [ Flowpack.ElasticSearch.ContentRepositoryAdaptor] ( https://github.com/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor ) or
56* [ Flowpack.SimpleSearch.ContentRepositoryAdaptor] ( https://github.com/Flowpack/Flowpack.SimpleSearch.ContentRepositoryAdaptor ) .
67
@@ -43,7 +44,7 @@ Thus you can easily adjust the rendering per type like this for an imaginary `Ac
4344
4445Feel free to use the ` DocumentSearchResult.html ` in the Flowpack.SearchPlugin as an example.
4546
46- ## Search suggestions
47+ ## Search completions and suggestions
4748
4849The default search form template comes with a ` data-autocomplete-source ` attribute pointing to the
4950` SuggestController ` of this package. Fed with a ` term ` parameter via a ` GET ` request, it returns a
@@ -53,7 +54,47 @@ the `_all` field, i.e. "the fulltext index".
5354These can be used to provide autocompletion on the search input using a JS library of your choice.
5455In case you need to build the URI to the suggest controller yourself, this is what the form uses:
5556
56- {f:uri.action(action: 'index', controller: 'Suggest', package: 'Flowpack.SearchPlugin', format: 'json', absolute: 1)}
57+ {f:uri.action(action: 'index', controller: 'Suggest', package: 'Flowpack.SearchPlugin', format: 'json', absolute: 1, arguments: {contextNodeIdentifier: node.identifier, dimensionCombination: dimensionCombination})}
58+
59+ The returned JSON looks like this (with a ` term ` of "content" after indexing the Neos demo site):
60+
61+ {
62+ "completions": [
63+ "content",
64+ "content element",
65+ "content in",
66+ "content in neos",
67+ "content in neos because",
68+ "content in neos because you",
69+ "content repository"
70+ ],
71+ "suggestions": [
72+ {
73+ "text": "995c9174-ddd6-4d5c-cfc0-1ffc82184677",
74+ "score": 20,
75+ "payload": {
76+ "nodeIdentifier": "d17caff2-f50c-d30b-b735-9b9216de02e9"
77+ }
78+ },
79+ {
80+ "text": "a66ec7db-3459-b67b-7bcb-16e2508a89f0",
81+ "score": 20,
82+ "payload": {
83+ "nodeIdentifier": "fd283257-9b12-8412-f922-6643ac818294"
84+ }
85+ },
86+ {
87+ "text": "a3474e1d-dd60-4a84-82b1-18d2f21891a3",
88+ "score": 20,
89+ "payload": {
90+ "nodeIdentifier": "7eee2ee6-2a4e-5240-3674-2fb84a51900b"
91+ }
92+ }
93+ ]
94+ }
95+
96+ The ` completions ` can be used to suggest search terms to the user. The ` suggestions ` contains
97+ "top search results" for the given term, the document they refer to is given in the ` payload ` .
5798
5899## AJAX search
59100
0 commit comments