Skip to content

Commit

Permalink
fix extract schema (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
karanataryn authored Dec 9, 2024
1 parent 4b69ea9 commit 0981618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from sycamore.data.document import Document
from sycamore.connectors.base_writer import BaseDBWriter
from sycamore.connectors.common import flatten_data, check_dictionary_compatibility
from sycamore.connectors.common import flatten_data, check_dictionary_compatibility, drop_types

if typing.TYPE_CHECKING:
from elasticsearch import Elasticsearch
Expand Down Expand Up @@ -90,7 +90,7 @@ def bulk_action_generator():
yield {
"_index": target_params.index_name,
"_id": r.doc_id,
"properties": r.properties,
"properties": drop_types(r.properties),
"embedding": r.embedding,
"parent_id": r.parent_id,
}
Expand Down
3 changes: 2 additions & 1 deletion lib/sycamore/sycamore/transforms/extract_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def extract_properties(self, document: Document) -> Document:
answer = extract_json(payload)
except (json.JSONDecodeError, AttributeError):
answer = entities

if answer == "None":
answer = {}
if "entity" in document.properties:
document.properties["entity"].update(answer)
else:
Expand Down

0 comments on commit 0981618

Please sign in to comment.