Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deleting by query #92

Closed
abhalla-atl opened this issue Apr 14, 2016 · 5 comments
Closed

Support deleting by query #92

abhalla-atl opened this issue Apr 14, 2016 · 5 comments

Comments

@abhalla-atl
Copy link

The Scala client currently only supports deleting by objectId. It would be useful to delete by query, similar to what's supported in the Ruby client (https://www.algolia.com/doc/ruby#delete-by-query). In our case, our objectId is structured enough that we could also match a pattern/regex against the objectId field, but querying against fields in our search documents would work quite well, too.

@ElPicador
Copy link

tldr; For now we won't support the delete by query in the scala client.

Longer:
Delete by query is basically a full browse + delete by id.
A full browse is N sequential calls to the browse API using a cursor.

The issue is that browse returns a Future[Iterable[A]]. So chaining multiple browse will return something like a Iterable[Future[Iterable[A]]]], not so nice but manageable.
But as each call to browse needs the previous call to get the cursor, so we need to transform an asynchronous API to a synchronous one, not so nice either.

One possible solution would be to use an Iteratee, but it will add a new dependency to the client (scalaz).

For now, we don't think it's a good solution.

Maybe you have an idea on how to implement that?

@abhalla-atl
Copy link
Author

We use Scalaz (v. 7.1.7, by the way), so that wouldn't be problematic for us, although it might be tricky to manage if there's some Scalaz version incompatibility down the road.

Would it be possible for you to change your REST API to support delete by query? If so, it would be trivial to implement in any client. :)

@ElPicador
Copy link

Nice to hear people using Scalaz :)
The issue is that you are not the only users, so we prefer not to add a dependency to Scalaz.

As for the REST API, it's currently not in our roadmap, as every API client has it (but scala).

@abhalla-atl
Copy link
Author

I don't have a better idea for implementation, but it seems that a synchronous implementation would be better than no implementation at all. Otherwise the consumers will be implementing the same sort of API independently, and you'll have little control over making improvements to their implementation.

@ElPicador
Copy link

Ok, we'll implement a synchronous deleteByQuery

algoliareadmebot added a commit to algoliareadmebot/algoliasearch-client-scala that referenced this issue Jul 18, 2016
  Update README Scala
  [This list might not be relevant]
  Typo (algolia#92) [ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants