cernopendata / cernopendata-client

CERN Open Data command-line client
http://cernopendata-client.readthedocs.io/
GNU General Public License v3.0
10 stars 9 forks source link

search by title not working #19

Closed tiborsimko closed 4 years ago

tiborsimko commented 4 years ago

Use case: look up record by CMS dataset titles:

$ cernopendata-client get-record --title '/BTau/Run2010B-Apr21ReReco-v1/AOD'

This is not working in a similar manner as #18, so the fix will be similar.

Note that it could happen that some title would be identical in two records, for example when the record title is not the dataset name, but some free text. We should issue an error when title lookup returns more than one hit.

tiborsimko commented 4 years ago

After #18 was fixed, the error message is:

$ cernopendata-client get-record --title '/BTau/Run2010B-Apr21ReReco-v1/AOD'
More than one record fit this title. This should not happen.

See two records: http://opendata.cern.ch/search?page=1&size=20&q=title:%22%2FBTau%2FRun2010B-Apr21ReReco-v1%2FAOD%22

However, there is precisely one dataset record matching the given title exactly, record ID 1, which should be returned...

tiborsimko commented 4 years ago

(which means that this issue may need to amend search capabilities to offer "exact matching" option)

tiborsimko commented 4 years ago

Just for completeness, here is an example that works:

$ cernopendata-client get-file-locations --title '/DoubleElectron/Run2012B-v1/RAW'
tiborsimko commented 4 years ago

@ParthS007 The last example broke after recent refactoring merge (#32). Can you please look at it?

$ cernopendata-client get-file-locations --title '/DoubleElectron/Run2012B-v1/RAW'
...
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

P.S. It would be good to start introducing test suite to catch these early. I'll create an issue about it.

tiborsimko commented 4 years ago

cernopendata-client get-file-locations --title '/DoubleElectron/Run2012B-v1/RAW'

Fixed as part of PR #42.

The only remaining problem is now returning multiple records. I'll create a separate issue for this.