Not a sarcastic question, I was asked this question by a client - the client is unhappy with how their data is presented (with commas, leading zeros removed) and the lack of contains search options.
Numeric fields sort correctly as well (a list of 1, 4, 11 will sort in that order if it is a number, but 1, 11, 4 if it is text)
I don't think there's anything you can do about the leading 0s, but in look and feel, you can tell it not to render thousand/million/billion separators.
However, from the question, it's clear that your people should be using string fields, as they're expecting the data to behave as a string. I'd swap to string fields and then tell them not to enter them incorrectly (or possibly validate)
While I don’t know the full ins and outs of lucene performance between string and numeric fields, I feel like there’s a chance that a numeric field is more efficient to store/search a value than a string field with numbers in it (anyone able to confirm or deny)?
on top of that (and the answers above) though, from a functional point of view, if you may want to do range based queries on the values, a numeric will be better.
CCM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It sounds like your instinct is that numeric fields are computationally faster than text. You are right. A numeric field is faster than a text field for almost all operations.
But a little bit of performance is nothing to worry about when you're looking at a field, you should go with what gets your people the answers they want. I would much rather get "right answer in 10 seconds" than "possibly a right answer, but we're not sure, in 8 seconds"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Rob Horan
No there is no advantage past that. If however you are doing any fancy scripting though then I would suggest using the number field because your text field is usually converted to String rather than a number and you then need to convert again to number, hoping that the entry is valid.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.