-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
feature-parityFeature parity with upstream tantivyFeature parity with upstream tantivyhelp wantedExtra attention is neededExtra attention is needed
Description
The current implementation doesn't seem to handle Value::Bytes:
>>> import tantivy
>>> schema = tantivy.SchemaBuilder().add_bytes_field("foo", indexed=True).build()
>>> tantivy.Query.term_query(schema, "foo", b"\x01\x02\x03")
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
tantivy.Query.term_query(schema, "foo", b"\x01\x02\x03")
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Can't create a term for Field `foo` with value `b'\x01\x02\x03'`.
As usual, the workaround is to use parse_query, but this is inconvenient:
>>> import base64
>>> index = tantivy.Index(schema)
>>> index.parse_query("foo:" + base64.b64encode(b"\x01\x02\x03").decode())
Query(TermQuery(Term(field=0, type=Bytes, [1, 2, 3])))
Metadata
Metadata
Assignees
Labels
feature-parityFeature parity with upstream tantivyFeature parity with upstream tantivyhelp wantedExtra attention is neededExtra attention is needed