Skip to content

Panic when add_json value includes list #353

Closed
@mgao6767

Description

@mgao6767

To reproduce,

import tantivy

schema_builder = tantivy.SchemaBuilder()
schema_builder.add_json_field("data", stored=True)
schema = schema_builder.build()

index = tantivy.Index(schema)

index_writer = index.writer()

json_data = {
    "name": "John Doe",
    "age": 30,
    "email": "[email protected]",
    "interests": ["reading", "hiking", "coding"],
}

doc = tantivy.Document()
doc.add_json("data", json_data)

index_writer.add_document(doc)

index_writer.commit()
index_writer.wait_merging_threads()

searcher = index.searcher()

query = tantivy.Query.all_query()

top_docs = searcher.search(query, limit=10)

for score, hit in top_docs.hits:
    doc = searcher.doc(hit)
    print(doc["data"])  # pyo3_runtime.PanicException: not implemented

If json_data is

json_data = {
    "name": "John Doe",
    "age": 30,
    "email": "[email protected]",
}

then there is no problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions