Page MenuHomeSoftware Heritage

Use ':' for substring matching instead of '='
ClosedPublic

Authored by vlorentz on Feb 16 2022, 10:36 AM.

Details

Summary

I find it very confusing to use '=' for this operation.

Diff Detail

Repository
rDSEA Archive search
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D7183 (id=26022)

Could not rebase; Attempt merge onto 4e635b230a...

Updating 4e635b2..3107cad
Fast-forward
 docs/query-language.rst                              | 18 +++++++++---------
 setup.py                                             | 20 +++++++++++++++++++-
 swh/search/elasticsearch.py                          |  4 ++--
 swh/search/query_language/grammar.js                 |  5 +++--
 swh/search/query_language/sample_query               |  4 ++--
 .../query_language/test/corpus/combinations.txt      | 20 ++++++++++----------
 swh/search/query_language/tokens.js                  |  2 ++
 swh/search/tests/test_elasticsearch.py               |  2 +-
 swh/search/tests/test_translator.py                  |  4 ++--
 9 files changed, 50 insertions(+), 29 deletions(-)
Changes applied before test
commit 3107cad2bf837cdcc083cf856a1976dbd715559b
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Feb 16 10:36:10 2022 +0100

    Use ':' for substring matching instead of '='
    
    I find it very confusing to use '=' for this operation.

commit 3eed4b99a764eeb5b53cc47e92cf4246856e4caa
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Feb 16 10:27:35 2022 +0100

    setup.py: Regenerate parser when sources were changed

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/309/ for more details.

only : is still confusing to me, how about using := or ~ instead ?

IMO ~ implies some sort of regexp or glob match, but here this is essentially a substring search. : is consistent with the syntax used by Google, Bing, DDG, ...

IMO ~ implies some sort of regexp or glob match, but here this is essentially a substring search. : is consistent with the syntax used by Google, Bing, DDG, ...

Alright, then.

This revision is now accepted and ready to land.Feb 16 2022, 12:10 PM