Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Str representation for integer. #3698

Closed
fulmicoton opened this issue Aug 1, 2023 · 4 comments
Closed

Str representation for integer. #3698

fulmicoton opened this issue Aug 1, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed project:airmail

Comments

@fulmicoton
Copy link
Contributor

(As requested by a customer but also motivated by #3621)

Javascript (Java too?) does not play well with u64.
It would be nice to add option in the mapper to set the representation of integers as "string" for numbers.

If the option is set to false, everything happens like today. Strings as an input are rejected, and the values are encoded
as Json numbers.

If a user sets: string_in_json: true, then we would accept BOTH, strings and numbers as an input.
In addition, when we recreate JSON for documents, we would encode the values as strings.

@fulmicoton fulmicoton added enhancement New feature or request project:airmail good first issue Good for newcomers help wanted Extra attention is needed labels Aug 1, 2023
@PSeitz
Copy link
Contributor

PSeitz commented Aug 1, 2023

This can be achieved with tantivy coerce option on text fields https://docs.rs/tantivy/latest/tantivy/schema/struct.TextOptions.html#method.set_coerce
It would store the numbers as string internally though, not sure if that is desired.

@guilload
Copy link
Member

guilload commented Aug 1, 2023

Can we decouple ingestion and search and go with the parameters that we already use for other fields: input_formats and output_format?

@fulmicoton
Copy link
Contributor Author

That makes sense, although in this very case, there is very little upside to not allowing both string and number.
input_formats is not as important.

@guilload
Copy link
Member

guilload commented Aug 4, 2023

Closed via #3704.

@guilload guilload closed this as completed Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed project:airmail
Projects
None yet
Development

No branches or pull requests

3 participants