serhiy-bzhezytskyy opened a new pull request, #191:
URL: https://github.com/apache/solr-orbit/pull/191

   Stacked on #179: its commits come first in this branch and drop out of the 
diff when it merges.
   
   geonames' `painless_static`, `painless_dynamic`, `field_value_script_score` 
and `decay_geo_gauss_script_score` run as `q=*:*`: a `script_score` in Painless 
falls back to a match-all query, so the four time plain counts.
   
   Painless and Lucene expressions both compile to bytecode that is run for 
every matching document over its doc values. The converter now reads the 
numeric part of Painless and writes the expression that computes the same 
number, registered in the config set as #179 does for the expression language 
([Expression Value Source 
Parser](https://solr.apache.org/guide/solr/latest/query-guide/expression-value-source-parser.html)).
 It reads arithmetic, the `Math` functions that Lucene expressions also have, 
`doc` values, `_score` and `decayGeoGauss`, which it writes out with the 
distance in meters. Casts and `get(0)` are dropped, since the field is 
single-valued. Anything else, such as a loop, `def` or `Math.random()`, is 
refused and not approximated.
   
   | operation | worst relative difference from OpenSearch's score, 5,000 
documents |
   |---|---|
   | `painless_static` | 1.56e-07 |
   | `painless_dynamic` | 1.56e-07 |
   | `field_value_script_score` | 0 |
   | `decay_geo_gauss_script_score` | 2.04e-07 |
   
   Both controls differ: with latitude and longitude swapped in the generated 
query 1.42, and with the query of another function 2.76e+15. Solr 10.1.0 and 
OpenSearch 3.10.0, the documents' `id`, `population` and `location`, the 
upstream bodies with `match_all` replaced by an `ids` query over the sample, 
which scores 1.0 as `match_all` does.
   
   Not covered: a script outside the numeric subset is refused and converted as 
before.
   
   Test with:
   ```
   solr-orbit convert-workload --workload-path 
<opensearch-benchmark-workloads>/geonames --output-path /tmp/geonames-solr
   grep -c "custom_func_" /tmp/geonames-solr/operations/default.json
   pytest tests/unit/solr -k PainlessScripts
   ```
   `grep -c` prints 5 (it printed 1, the `expression` operation of #179); 
pytest prints `9 passed`.
   


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