Silverstripe Version: 4.3.2
I am trying to enable search on a site but for the life of me I have been unsuccessful in doing so.
I would like to have a site wide search but also be able to filter the results by tags and category. I canāt even get the search to work
I used the tutorial in the lessons (https://www.silverstripe.org/learn/lessons/v4/working-with-data-relationships-has-many-1) which does show results but doesnāt seem to priorities search terms and seems to be more focused on the filtering part of searching.
I have also tried to enable FulltextSearchable, but when I place
SilverStripe\ORM\Search\FulltextSearchable::enable();
in my _config.php I receive the following error
error-log.ERROR: Uncaught Exception TypeError: "Argument 1 passed to SilverStripe\Config\MergeStrategy\Priority::mergeArray() must be of the type array, string given, called in /.../vendor/silverstripe/framework/src/Core/Config/Middleware/InheritanceMiddleware.php on line 43" at /.../vendor/silverstripe/config/src/MergeStrategy/Priority.php line 59 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to SilverStripe\\Config\\MergeStrategy\\Priority::mergeArray() must be of the type array, string given, called in /.../vendor/silverstripe/framework/src/Core/Config/Middleware/InheritanceMiddleware.php on line 43 at /.../vendor/silverstripe/config/src/MergeStrategy/Priority.php:59)"} []
I am pretty sure this is due to me installing silverstripe/silverstripe-fulltextsearch. I have tried to remove silverstripe-fulltextsearch with
composer remove silverstripe/fulltextsearch && vendore/bin/fulltextsearch_quickstart
but when I run a dev/build after removing fulltextsearch I recieve the following error
error-log.ALERT: Fatal Error (E_ERROR): Uncaught InvalidArgumentException: SilverStripe\ORM\DataObject references nonexistent SilverStripe\FullTextSearch\Search\Extensions\SearchUpdater_ObjectHandler in 'extensions' in /.../vendor/silverstripe/framework/src/Core/Config/Middleware/ExtensionMiddleware.php:70 Stack trace: #0 /.../vendor/silverstripe/framework/src/Core/Config/Middleware/ExtensionMiddleware.php(41): SilverStripe\Core\Config\Middleware\ExtensionMiddleware->getExtraConfig('SilverStripe\\OR...', Array, 0) #1 /.../vendor/silverstripe/config/src/Middleware/MiddlewareAware.php(56): SilverStripe\Core\Config\Middleware\ExtensionMiddleware->getClassConfig('SilverStripe\\OR...', 0, Object(Closure)) #2 /.../vendor/silverstripe/framework/src/Core/Config/Middleware/InheritanceMiddleware.php(30): SilverStripe\Config\Collections\MemoryConfigCollection {"code":1,"message":"Uncaught InvalidArgumentException: SilverStripe\\ORM\\DataObject references nonexistent SilverStripe\\FullTextSearch\\Search\\Extensions\\SearchUpdater_ObjectHandler in 'extensions' in /.../vendor/silverstripe/framework/src/Core/Config/Middleware/ExtensionMiddleware.php:70\nStack trace:\n#0 /.../vendor/silverstripe/framework/src/Core/Config/Middleware/ExtensionMiddleware.php(41): SilverStripe\\Core\\Config\\Middleware\\ExtensionMiddleware->getExtraConfig('SilverStripe\\\\OR...', Array, 0)\n#1 /.../vendor/silverstripe/config/src/Middleware/MiddlewareAware.php(56): SilverStripe\\Core\\Config\\Middleware\\ExtensionMiddleware->getClassConfig('SilverStripe\\\\OR...', 0, Object(Closure))\n#2 /.../vendor/silverstripe/framework/src/Core/Config/Middleware/InheritanceMiddleware.php(30): SilverStripe\\Config\\Collections\\MemoryConfigCollection","file":"/.../vendor/silverstripe/framework/src/Core/Config/Middleware/ExtensionMiddleware.php","line":70,"trace":null} []
I do have Solr installed on my system but I donāt seem to be able to access it. It is a VPS running WHM and cPanel if that helps.
I have also tried the following addons ājaedb/searchā, axllent/silverstripe-ftsearch and nglasl/silverstripe-extensible-search but canāt seem to get them going, although this is probably due to me not understanding the documentation properly, as I am not a programmer, so have probably placed things in the wrong files.
If someone has successfully enabled a search on their site can you please explain how you did it, which files you modified and the basic code you used?
Essentially, what I am trying to do is have a search form in the header of my site which goes to a results page that displays the results of the search. I also have a separate search form on the homepage that has an advanced search option to filter the pages by Tags (using silverstripe/silverstripe-tagfield) and by some categories (which are selected in the admin section using a simple dropdown field).
Documentation for a search feature seems to be lacking for SilverStripe 4, hopefully this thread can be of assistance for other people in the same situation as me. If I work something out I will definetly post it back here.