As an integer 0045 or 000000000000045 or 45 is exactly the same value in the decimal positional format.
I agree with Charlie, if you need it to be a string, then use a string. You can potentially just use the string as a stored value, a copy field if you like and keep the original indexed as an integer to do math search operations on. Cheers On Mon, 3 Jul 2023, 13:01 Charlie Hull, <ch...@opensourceconnections.com> wrote: > I think you're trying to fit a square peg into a round hole here. > > I've never seen an integer type keep the preceding zeros like you > suggest - if you need to preserve the format, use a string type. If you > just need an integer, use an integer. > > Charlie > > On 03/07/2023 12:01, John Jackson wrote: > > Hi All, > > > > > > > > We are using the *int data type* field in Solr. The value which we are > > trying to add is *0045*. While Solr inserts this value into that field it > > will automatically remove the preceding *'00'*. The value shown in Solr > is > > *45*. Provide the solution to overcome this problem and add the data same > > as *0045* in Solr without changing *int* data type. > > > > > > > > Original Value = *0045* > > > > > > > > Current Value in Solr = *<int> 45 </int>* > > Expected Value in Solr = *<int> 0045 </int>* > > > > > > > > > > > > *Schema.xml* > > > > > > > > *<dynamicField name="test" type="int" indexed="true" stored="true" />* > > > > > > > > > > > > *Note => We need to achieve the value with the Preceding zeros in Solr > > without changing the data type from int.* > > > > > > > > > > > > Thanks & Regards, > > *Shubham Panchal* > > > -- > Charlie Hull - Managing Consultant at OpenSource Connections Limited > Founding member of The Search Network and co-author of Searching the > Enterprise > tel/fax: +44 (0)8700 118334 > mobile: +44 (0)7767 825828 > > OpenSource Connections Europe GmbH | Pappelallee 78/79 | 10437 Berlin > Amtsgericht Charlottenburg | HRB 230712 B > Geschäftsführer: John M. Woodell | David E. Pugh > Finanzamt: Berlin Finanzamt für Körperschaften II > >