Comments (7)
Hey.
Could you open a PR with your fix? :)
from meilisearch-symfony.
Seems a little hacky, plus it requires end user the knowledge of having to flag each DateTimeInterface
property with
#[Serializer\Context([DateTimeNormalizer::FORMAT_KEY => 'U'])]
.
We could enforce that context configuration to avoid that, but this could conflict with other serializer usages, which prefer using DateTimeInterface::ATOM
for serialization (typically, API-Platform projects).
Another solution would be to drop some arbitrary property in the context as early as possible, to tell the serializer that it's the bundle that requested the serialization. This way it would know that DateTimeInterface
objects have to be normalized as unix timestamp integers.
Or, the ability to use a different serializer instance.
I'll try to have a look at this.
from meilisearch-symfony.
I think we can add format key to the context in Meilisearch\Bundle\SearchableEntity::getSearchableArray
without breaking anything 🤔
from meilisearch-symfony.
I think we can add format key to the context in
Meilisearch\Bundle\SearchableEntity::getSearchableArray
without breaking anything 🤔
Oh, didn't think about that, I just dropped #309 with a meilisearch: true
context parameter. Might be useful in some other cases tho - WDYT?
from meilisearch-symfony.
If meilisearch allows to store timestamps as strings then I'd go for directly configuring format without adding meilisearch
to the context, but this needs to be tested then, otherwise current solution is the way to go 👍
from meilisearch-symfony.
Nope, I already tested that, dates aren't searchable with date1 TO date2
filter when they're stored as a unix-timestamp strings - they have to be casted as integers, which is why I had to add a dedicated normalizer (otherwise using existing DateTimeNormalizer would have done the trick indeed)
from meilisearch-symfony.
Sadly there is no way to configure DateTimeNormalizer to call getTimestamp
instead of format('U')
😞
from meilisearch-symfony.
Related Issues (20)
- Use PHP CS with the PSR standards HOT 3
- [RFC] bump php to v8+ and Symfony to v5.4+ HOT 2
- [RFC] add data collector for profiler and debug HOT 3
- setting: "distinctAttribute" type inconsistency HOT 5
- Working with facets HOT 2
- Enable re-indexation with `indexSwap`
- Autowiring should not be used
- Commands should use `meilisearch:` prefix instead of `meili:`
- Parameters should use `meilisearch.` prefix HOT 1
- Authorization fails
- Add CodeCov HOT 2
- Page fixture in tests uses deprecated Doctrine type `Object`
- Broken links in README
- Support Symfony 7 HOT 1
- Indexing plain objects without entitymanager HOT 2
- `nbResults` is not set / ignored
- Import of Mongo ODM entities fails HOT 4
- Ability to use filters on index for additional searchparams/options HOT 5
- Use PUT operation to update existing document(s) HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meilisearch-symfony.