rnewson opened a new pull request, #5021:
URL: https://github.com/apache/couchdb/pull/5021

   ## Overview
   
   Nouveau has a (somewhat ugly) extension to the query syntax that 
auto-detects if the searched _value_ is a number. if so,
   it switches to querying the field as a number.
   
   If, however, you've indexed a string that looks like a number, this 
behaviour prevents you from querying the field correctly.
   
   Instead of that, this PR switches to the 'normal' approach in Lucene, namely 
the StandardQueryParser with a "points config"
   that details which fields are numbers. With this extra information the query 
parser performs the correct kind of query for text or string fields that happen 
to have values that look like numbers and double fields, which actually have 
numbers.
   
   The fundamental problem is that we don't declare a schema ahead of time. I 
could extend the IndexDefinition so that we know the types of all fields ahead 
of time (and use it to build the points config). For now, I preserve the 
ability to dynamically generate fields in the index function by introspecting 
the index when opening it, to build an initial points config map, and then 
checking on every index update for a new double field, modifying the points 
config map accordingly.
   
   Flagging this as draft as I lose the ability to specify "locale" (as 
construction of NumberFormat moves from query time to index opening time) and 
as I'd like to discuss it further before going this way.
   
   Another notable issue for the future is that we will struggle to add other 
numeric types (FloatField, IntField, etc), as there will be no way (afaict) to 
figure this out retrospectively. It might be that I should be writing the 
fields types into a separate (hidden) field, or into the commit data object.
   
   Finally, note that the 'Infinity' and '-Infinity' bounds no longer work, but 
I think this is a good thing (`*` is easier to type).
   
   Discuss.
   
   ## Testing recommendations
   
   covered by tests
   
   ## Related Issues or Pull Requests
   
   https://github.com/apache/couchdb/issues/4997
   
   ## Checklist
   
   - [x] Code is written and works correctly
   - [x] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [ ] Documentation changes were made in the `src/docs` folder
   - [ ] Documentation changes were backported (separated PR) to affected 
branches
   


-- 
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]

Reply via email to