Skip to content

Commit

Permalink
Remove string conversion on struct id when deleting a document
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeyson committed Jul 12, 2023
1 parent 6c9d543 commit 5413195
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.4 (2023.07.12)

* Remove string conversion on struct id when deleting a document.

## 0.3.3 (2023.07.11)

* Add index_multiple_documents/1 clause for accepting struct args
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ExTypesense.search(schema.name, params)
ExTypesense.search(Person, params)
```
Check [cheatsheet](cheatsheet.html) for more examples
Check [cheatsheet](https://hexdocs.pm/ex_typesense/cheatsheet.html) for more examples
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
Expand Down
5 changes: 3 additions & 2 deletions lib/ex_typesense/document.ex
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ defmodule ExTypesense.Document do
"""
@spec delete_document(struct()) :: response()
def delete_document(struct) when is_struct(struct) do
document_id = to_string(struct.id)
document_id = struct.id
collection_name = struct.__struct__.__schema__(:source)
do_delete_document(collection_name, document_id)
end
Expand Down Expand Up @@ -376,7 +376,8 @@ defmodule ExTypesense.Document do
"""
@doc since: "0.3.0"
@spec delete_document(String.t(), integer()) :: response()
def delete_document(collection_name, document_id) when is_binary(collection_name) do
def delete_document(collection_name, document_id)
when is_binary(collection_name) and is_integer(document_id) do
do_delete_document(collection_name, document_id)
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule ExTypesense.MixProject do
use Mix.Project

@source_url "https://github.com/jaeyson/ex_typesense"
@version "0.3.3"
@version "0.3.4"

def project do
[
Expand Down

0 comments on commit 5413195

Please sign in to comment.