Tags: PHP-CMSIG/search
Tags
Add virtual packages for seal adapters (#620) All seal adapters will provide `cmsig/seal-adapter-implementation`. All seal adapters in core go with: ```json "provide": { "cmsig/seal-adapter-implementation": "self.version" }, ``` Custom adapters need provide the related / supported `cmsig/seal` version: ```json "provide": { "cmsig/seal-adapter-implementation": "0.12.0" }, ``` As I personally not a big fan of the virtual packages we will currently not require them in our `integration` packages. But third party are this way free to require it to make composer fail if no adapter was required by the project / library. This should help eventuall a future `contao/backend-search-bundle` package to require `"cmsig/seal-adapter-implementation": "^0.12"` if they want that behaviour.
Add support for JsonObjectField (#616) This adds a new field type which is just here to store metadata in a json object (`array<string, mixed>`). This kind of data is not search, facet or filterable. Usage: ```php new Index('test', [ 'uuid' => new Field\IdentifierField('uuid'), 'title' => new Field\TextField('title', sortable: true), 'metadata' => new Field\JsonObjectField('metadata'), ]); ``` ```php $engine->saveDocument([ 'uuid' => $uuid, 'title' => $title, 'metadata' => [ 'routeAttributes' => [ 'site' => 'example', ], ], ]); ``` See #614 This feature is experimental and may change in future releases.
Remove none found identifiers in reindex (#603) To make removal easier the reindex will automatically remove document which where not provided by requested by the ReindexConfig. This make specially handling inside ORMs or Listeners on Add, Update, Remove a lot easier. As they just need to feel up identifiers. Thx goes to @Toflar who provided suggestion in #472. fixes #472 ### ToDo - [x] Add test case - [x] Reindex is async and requires in some cases return a task
Add Static Factory methods for Conditions and Facets (#600) Current state is that for a good `DX` developers need to import `CmsIg\Seal\Search\Condition` and use `new Condition\...`. This looks like this: ```php use CmsIg\Seal\Search\Condition; $result = $this->engine->createSearchBuilder('blog') ->addFilter(new Condition\AndCondition( new Condition\EqualCondition('tags', 'Tech'), new Condition\OrCondition( new Condition\EqualCondition('tags', 'UX'), new Condition\EqualCondition('isSpecial', true), ), )) ->getResult(); ``` But some Code Styles prevent that and so they require to import every conditions by themselves. In that case the Developer Experience is bad as autocomplete don't work. For core based filters we could maybe create a additional `Condition` class which is a helper to quickly create the conditions without the need for `new SomeCondition`, this could look like this: ```php use CmsIg\Seal\Search\Condition\Condition; $result = $this->engine->createSearchBuilder('blog') ->addFilter(Condition::and( Condition::equal('tags', 'Tech'), Condition::or( Condition::equal('tags', 'UX'), Condition::equal('isSpecial', true), ), )) ->getResult(); ``` The query builder would so still be PHP and static code analyzer like phpstan can validate most params, but without the force of every conditions being imported by itself. ## Todo - [x] Add Condition class - [x] Add Facet class - [x] Update Tests - [x] Update Documentation --- fixes #481
Fix issues with filters by Date Fields (BC Break⚠️ ) (#594) Filters based on `datetime` fields seems currently not work correctly in: - [x] Loupe (expect integer in filter) - [x] Typesense (expect integer in filter) - [x] Meilisearch (expect integer in filter, and schema as integer) (requires drop reindex) - [x] Algolia (expect integer in filter, and schema as integer) (requires drop reindex) - [x] RediSearch (expect integer in filter, and schema as integer) (requires drop reindex) - [x] Solr (expect specific format in filters, and in indexing) (requires drop reindex)⚠️ `Marshaller` and `Flattenmarshaller` services also changed the `dateAsInteger: true` was removed in favor of `dateFormat: 'U'`. To allow different date formats for Example for Solr which requires a specific format. As they are still `@internal` there are no issues with BC Break here. But still a reindex is required for Solr, Redisearch and fixes #587
PreviousNext