-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Description
I am using a uuid for my id field and when I delete by id the delete does not happen (same with underscores). I don't think a hypen or an underscore needs to be escaped?
Removing the hypen or underscore and the delete works fine. I can work around this by removing the hyphen before writing
I was thinking that the - is being interpreted as a negation but it is underscores as well.
The Python code to recreate is below;
import json
from tantivy import Index, SchemaBuilder
schema_builder = SchemaBuilder()
schema_builder.add_text_field("id", fast=True)
schema = schema_builder.build()
index = Index(schema)
writer = index.writer()
id_str = "test-1"
source_doc = {
"id": id_str,
}
query = index.parse_query(f"id:{id_str}")
writer.add_json(json.dumps(source_doc))
writer.commit()
writer.wait_merging_threads()
index.reload()
result = index.searcher().search(query)
print(f"Insert: {result}")
writer = index.writer()
writer.delete_documents("id", id_str)
writer.commit()
index.reload()
result = index.searcher().search(query)
print(f"Deleted: {result}")
And I get the result
Insert: SearchResult(hits: [(0.57536423, DocAddress { segment_ord: 0, doc: 0 })], count: 1)
Deleted: SearchResult(hits: [(0.57536423, DocAddress { segment_ord: 0, doc: 0 })], count: 1)
Whereas without the hyphen I get as expected;
Insert: SearchResult(hits: [(0.28768212, DocAddress { segment_ord: 0, doc: 0 })], count: 1)
Deleted: SearchResult(hits: [], count: 0)
Metadata
Metadata
Assignees
Labels
No labels