nick-boss-tech opened a new pull request, #5071:
URL: https://github.com/apache/solr/pull/5071

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-5065
   
   ## What happens today
   
   **Exponents with a plus sign or a lowercase marker are not parsed by the 
parse-double and parse-float processors.**
   
   Forms such as `4.5E+10` (a plus sign) and `4.5e3` (a lowercase marker) do 
not parse. The shared helper runs `NumberFormat` on the whole value and checks 
that every character was used. When one was not, the value is left unchanged, 
and the processor logs that at debug level 
([parsePossibleDouble](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/java/org/apache/solr/update/processor/ParseDoubleFieldUpdateProcessorFactory.java#L102-L116)).
   
   ## What this change does
   
   **A trailing exponent is rewritten before `NumberFormat` runs, so both forms 
parse.**
   
   - A plus sign after the exponent marker is removed, and a lowercase marker 
becomes uppercase. `4.5E+10` becomes `4.5E10`, and `4.5e-3` becomes `4.5E-3` 
([helper](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/java/org/apache/solr/update/processor/ParseNumericFieldUpdateProcessorFactory.java#L49-L65)).
 The rewrite only touches a trailing exponent, so other values are not changed.
   - The double and float processors both call the helper 
([double](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/java/org/apache/solr/update/processor/ParseDoubleFieldUpdateProcessorFactory.java#L104),
 
[float](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/java/org/apache/solr/update/processor/ParseFloatFieldUpdateProcessorFactory.java#L93)).
   - The rewrite runs whatever `locale` is set.
   - The schema suggester uses the same helper 
([isFloatOrDouble](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/java/org/apache/solr/handler/designer/DefaultSchemaSuggester.java#L294-L300)).
 Samples with these forms now infer `pdouble`. This is an intended effect, and 
a test pins it.
   
   ## Proof
   
   **The suggester pin test fails without this change and passes with it.**
   
   - `ParsingFieldUpdateProcessorsTest` 44 of 44 pass with this change. The new 
tests are `testParseDoubleExponentForms` and `testParseFloatExponentForms` 
([tests](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java#L642-L719)).
   - `DefaultSchemaSuggesterTest` 2 of 2 pass 
([class](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/test/org/apache/solr/handler/designer/DefaultSchemaSuggesterTest.java#L31-L49)).
 The pin test is 
[`testGuessFieldTypeExponentFormsInferDouble`](https://github.com/nick-boss-tech/solr/blob/ab894a996c8aa9825c4ac5af38536aec1ee865eb/solr/core/src/test/org/apache/solr/handler/designer/DefaultSchemaSuggesterTest.java#L33-L41).
 It fails on the unmodified base, 0cc328310f8f, and passes with this change.
   - The module check is clean.
   - Verified 2026-10-09 at this head.
   
   ## Limits
   
   **Locale-aware parsing is not in this change. It stays open for the ticket.**
   
   - The rewrite ignores `locale`, so a non-ROOT locale gets the same exponent 
rewrite as ROOT. A locale-aware parse would be a separate choice.
   - No test runs an exponent form under a non-ROOT locale, or with spaces 
around the value.
   - The reference guide does not describe the accepted exponent forms. This 
change makes no documentation change.
   
   Changelog: `changelog/unreleased/SOLR-5065-parse-double-exponent-plus.yml`
   
   ### AI assistance
   
   AI agents assisted with research, implementation, review, and drafting. Nick 
Shanin directed the work and takes responsibility for this contribution.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to