{"id":26234866,"url":"https://github.com/flowpack/flowpack.searchplugin","last_synced_at":"2025-04-04T08:06:13.060Z","repository":{"id":17289738,"uuid":"20060029","full_name":"Flowpack/Flowpack.SearchPlugin","owner":"Flowpack","description":"A simple search plugin for Neos","archived":false,"fork":false,"pushed_at":"2025-04-04T07:42:42.000Z","size":219,"stargazers_count":24,"open_issues_count":5,"forks_count":31,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-04T07:51:19.150Z","etag":null,"topics":["elasticsearch","hacktoberfest","neoscms"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flowpack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-22T12:24:48.000Z","updated_at":"2025-04-02T10:44:00.000Z","dependencies_parsed_at":"2025-03-13T02:45:13.953Z","dependency_job_id":null,"html_url":"https://github.com/Flowpack/Flowpack.SearchPlugin","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.SearchPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.SearchPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.SearchPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.SearchPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flowpack","download_url":"https://codeload.github.com/Flowpack/Flowpack.SearchPlugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142063,"owners_count":20890652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elasticsearch","hacktoberfest","neoscms"],"created_at":"2025-03-13T02:29:34.314Z","updated_at":"2025-04-04T08:06:13.044Z","avatar_url":"https://github.com/Flowpack.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flowpack.SearchPlugin\n\n[![Latest Stable Version](https://poser.pugx.org/flowpack/searchplugin/v/stable)](https://packagist.org/packages/flowpack/searchplugin) [![Total Downloads](https://poser.pugx.org/flowpack/searchplugin/downloads)](https://packagist.org/packages/flowpack/searchplugin)\n\nThis plugin is a Search Plugin, to be used together with\n\n* [Flowpack.ElasticSearch.ContentRepositoryAdaptor](https://github.com/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor) or\n* [Flowpack.SimpleSearch.ContentRepositoryAdaptor](https://github.com/Flowpack/Flowpack.SimpleSearch.ContentRepositoryAdaptor).\n\n## Installation\n\nInstall via composer with your favorite adaptor:\n\n**ElasticSearch**\n\n    composer require flowpack/searchplugin flowpack/elasticsearch-contentrepositoryadaptor\n\n**SimpleSearch**\n\n    composer require flowpack/searchplugin flowpack/simplesearch-contentrepositoryadaptor\n\nInclusion of the routes from this package into your main `Configuration/Routes.yaml` is no longer needed as of Flow 4.0.\n\n## Configuration\n\n### Custom index name\n\nIt is usually a good idea to specify a custom index name for a project, instead of the default `typo3cr`. That\nway no conflicts can arise when multiple projects use the same Elasticsearch server.\n\nTo specify a custom index name, the following is needed:\n\n    Neos:\n      ContentRepository:\n        Search:\n          elasticSearch:\n            indexName: acmecom\n\n### Pagination\n\nThe pagination search results can be configured via Fusion. The following shows the defaults:\n\n    prototype(Flowpack.SearchPlugin:Search).configuration {\n        itemsPerPage = 25\n        insertAbove = false\n        insertBelow = true\n        maximumNumberOfLinks = 10\n    }\n\n### Custom result rendering\n\nThe result list is rendered using a Fusion object of type `nodeType + 'SearchResult'` for each hit.\nThus you can easily adjust the rendering per type like this for an imaginary `Acme.AcmeCom:Product` nodetype:\n\n    prototype(Acme.AcmeCom:ProductSearchResult) \u003c prototype(Neos.Neos:DocumentSearchResult) {\n        templatePath = 'resource://Acme.AcmeCom/Private/Templates/SearchResult/ProductSearchResult.html'\n    }\n\nFeel free to use the `DocumentSearchResult.html` in the Flowpack.SearchPlugin as an example.\n\n## Search completions and suggestions\n\nThe default search form template comes with a `data-autocomplete-source` attribute pointing to the\n`SuggestController` of this package.\n\nTo use this term suggester, you need to configure the indexing like this, to define a custom\nanalyzer to be used:\n\n    Flowpack:\n      ElasticSearch:\n        indexes:\n          default:      # client name used to connect (see Flowpack.ElasticSearch.clients)\n            acmecom:    # your (custom) index name\n              settings:\n                analysis:\n                  filter:\n                    autocompleteFilter:\n                      max_shingle_size: 5\n                      min_shingle_size: 2\n                      type: 'shingle'\n                  analyzer:\n                    autocomplete:\n                      filter: [ 'lowercase', 'autocompleteFilter' ]\n                      char_filter: [ 'html_strip' ]\n                      type: 'custom'\n                      tokenizer: 'standard'\n\nThen you need to configure the node types to be be included in the suggestion building, this can be\ndone like this:\n\n    'Neos.Neos:Document':\n      superTypes:\n        'Flowpack.SearchPlugin:SuggestableMixin': true\n        'Flowpack.SearchPlugin:AutocompletableMixin': true\n\n    'Neos.Neos:Shortcut':\n      superTypes:\n        'Flowpack.SearchPlugin:SuggestableMixin': false\n        'Flowpack.SearchPlugin:AutocompletableMixin': false\n\n    'Neos.NodeTypes:TitleMixin':\n      superTypes:\n        'Flowpack.SearchPlugin:SuggestableMixin': true\n        'Flowpack.SearchPlugin:AutocompletableMixin': true\n\nWhen fed with a `term` parameter via a `GET` request, the `SuggestController` will return a\nJSON-encoded array of suggestions from Elasticsearch. They are fetched with a term suggester\nfrom the `_all` field, i.e. \"the fulltext index\".\n\nThese can be used to provide autocompletion on the search input using a JS library of your choice.\nIn case you need to build the URI to the suggest controller yourself, this is what the form uses:\n\n    {f:uri.action(action: 'index', controller: 'Suggest', package: 'Flowpack.SearchPlugin', format: 'json', absolute: 1, arguments: {contextNodeIdentifier: node.identifier, dimensionCombination: dimensionCombination})}\n\n### Adjust the suggestion context\n\nThe suggestionContext determines, if a result should be displayed in suggetions. By default, nodes that are hidden are excluded.\nIn many projects, the search als takes the Neos.Seo metaRobotsNoindex property into account or excludes certain nodeTypes. In order to adjust the suggestion context to your search logic, you can write your custom logic and switch the implementation of the `Flowpack\\SearchPlugin\\Suggestion\\SuggestionContextInterface` via Objects.yaml\n\n### Create URIs for suggestions\n\nTo create valid links for suggestions the following package can be used:\n\n* [Punktde.OutOfBandRendering](https://github.com/punktDe/outofbandrendering)\n\nConnect the given example of this package with a custom fusion object:\n\n    pathToProtoType = Your.Vendor:Content.NodeLink\n\nAnd finally add the new property to the plugin settings:\n\n    Flowpack:\n      SearchPlugin:\n        searchAsYouType:\n          suggestions:\n            sourceFields:\n              - title\n              - __myProperty\n\n## AJAX search\n\nThe plugin comes with a controller that can be reached like this per default, using `GET`:\n\n    {f:uri.action(action: 'search', controller: 'AjaxSearch', package: 'Flowpack.SearchPlugin', arguments: {node: node, q: ''}, absolute: 1)}\n\nIt expects the search term as a parameter named `q` (as defined in `AjaxSearch.fusion`). This controller\nrenders the search results and returns them as HTML without any of the page template. It can therefore\nbe used to request search results via AJAX and display the result by adding it to the DOM as needed.\n\n## Removing special chars from search term\n\nIt is recommended to remove characters, which are reserved in Elasticsearch from the search term to prevent errors. There is \nan eel helper to replace them before submitting the search like this:\n\n    prototype(Flowpack.SearchPlugin:Search) {\n        searchTerm = ${Flowpack.SearchPlugin.SearchTerm.sanitize(request.arguments.search)}\n    }\n\nKeep in mind, that this blocks the explicit use of wildcards (`*`) and phrase search (`\"search exactly this\"`)\nfor your users, in case you want to support that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowpack%2Fflowpack.searchplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowpack%2Fflowpack.searchplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowpack%2Fflowpack.searchplugin/lists"}