Add (or document) the new filter and fetch in 1.2
tacman opened this issue · comments
These 2 new features look pretty useful, and 1.2 is scheduled for release in less than 2 weeks. Does this php library already support making these calls? If so, can we document them? If not, can we add and document them? Thx.
From: https://github.com/meilisearch/meilisearch/releases
You can now use filters in the GET endpoint of the /documents route:
curl -X GET 'http://localhost:7700/indexes/dogs/documents?limit=1&filter=doggo=bernese'
You can also use the new /documents/fetch route to handle complex filters:
curl -X POST http://localhost:7700/indexes/dogs/documents/fetch
-H 'Content-Type: application/json'
--data-binary '{ "limit": 1, "filter": "doggo = bernese" }'
Hi @tacman!
I appreciate your issue. For your information, PHP will surely support the new features, and I'm currently working on them! Also, the new meilisearch-php will be out the same day as the Meilisearch v1.2 release 🎉
Can you help me out with how to test?
composer require meilisearch/meilisearch-php:"dev-fix-lint-errors" -W
./composer.json has been updated
Running composer update meilisearch/meilisearch-php --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires meilisearch/meilisearch-php dev-fix-lint-errors, found meilisearch/meilisearch-php[dev-tmp-full-changes, dev-update-release-v0_18_4, dev-meilisearch-finite-pagination-beta, dev-dependabot/composer/phpstan/phpstan-1.10.15, dev-code-analizer-ci, dev-main, dev-staging, dev-trying, dev-healthy, dev-add-delete-by-filter, dev-bump-meilisearch-v1.2.0, v0.8.1, ..., v0.27.0, v1.0.0, v1.1.0, v1.1.1] but it does not match the constraint.
Problem 2
- meilisearch/search-bundle is locked to version v0.11.0 and an update of this package was not requested.
- meilisearch/search-bundle v0.11.0 requires meilisearch/meilisearch-php ^1.0.0 -> found meilisearch/meilisearch-php[v1.0.0, v1.1.0, v1.1.1] but it conflicts with your root composer.json require (dev-fix-lint-errors).
Go ahead! the deleteDocuments
is finished. You can check the details here: #509
The getDocuments
I'm still waiting for some details in the code review here: #510
Since the deleteDocuments
is done, you can directly use the bump branch: bump-meilisearch-v1.2.0
, let me know if you find any inconsistencies. Just remember to use the latest Meilisearch version, in this case: v1.2.0-rc.2
I removed my dependency on meili-search and now have installed 1.2-rc2 and this bump branch.
Is there a way to call the filter for getting documents? Or just deleting them?
I saw a reference to a "addFilter()" method on DocumentsQuery, but that's outdated, right? If there's a way to call it, I'll test it. Thx.
I think I'm missing something basic. Within the new branch, how do I create a filter on the DocumentsQuery?
Hi @tacman if you already configured correctly your application to the meilisearch-php branch bump-meilisearch-v1.2.0
and are using the Meilsearch v1.2.0-rc.0, you must be able to use the filter.
$index->updateFilterableAttributes(['price']);
$response = $index->getDocuments((new DocumentsQuery())->setFilter(['price > 100']));
Also, I can't find anything related to addFilter
in the codebase
works perfectly! Thanks!