tantivy
tantivy copied to clipboard
Make allocating field names avoidable for range and exists queries.
If the field names are statically known, Cow::Borrowed(&'static str) can handle them without allocations. The general case is still handled by Cow::Owned(String).
I don't think a single allocation per query won't have a measurable impact on performance, therefore I'd prefer the more readable variant.
therefore I'd prefer the more readable variant.
I tried to anticipate this via the trait bound Into<Cow<'static, str>> so that call sites do not need to care about the Cows. But I suspect you mean readability of the implementation?