Commit 3b82d484 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update InvenioStore to revisit doc strings.

parent e94e99ae
# Invenio tools
This section describes keywords which can be used to search record within
an invenio store. They depend on the invenio version
## inspirehep.net (March 2020)
New version deployed in March 2020
The previous version as available in the store old.inspirehep.net.
## old.inspirehep.net and cds.cern.ch
Search criteria are defined by the keywords arguments.
The complete list of keyword arguments can be found at
[https://old.inspirehep.net/help/hacking/search-engine-api](
https://old.inspirehep.net/help/hacking/search-engine-api)
Examples how to use the invenio API:
[https://old.inspirehep.net/info/hep/api?ln=fr#json_fnames](
https://old.inspirehep.net/info/hep/api?ln=fr#json_fnames)
List of keyword in the JSON record:
[https://github.com/inspirehep/invenio/blob/prod/modules/bibfield/etc/atlantis.cfg](
https://github.com/inspirehep/invenio/blob/prod/modules/bibfield/etc/atlantis.cfg)
cc (str):
current collection (*e.g.* "ATLAS").
The collection the user started to search/browse from.
c (str):
collection list (*e.g.* ["Theses", "Books"]).
The collections user may have selected/deselected when
starting to search from **cc**.
ec (str):
external collection list (*e.g.* ["CiteSeer", "Google"]).
The external collections may have been selected/deselected
by the user.
p (str):
pattern to search for (*e.g.* "ellis and muon or kaon").
f (str):
field to search within (*e.g.* "author").
rg (int):
records in groups of (*e.g.* "10").
Defines how many hits per collection in the search results
page are displayed.
sf (str):
sort field (*e.g*. "title").
so (str):
sort order ("a"=ascending, "d"=descending).
sp (str):
sort pattern (*e.g.* "CERN-") -- in case there are more
values in a sort field, this argument tells which one
to prefer.
rm (str):
ranking method (*e.g.* "jif").
Defines whether results should be ranked by some known
ranking method.
of (str):
output format (*e.g.* "hb").
Usually starting "h" means HTML output (and "hb" for HTML
brief, "hd" for HTML detailed), "x" means XML output,
"t" means plain text output, "id" means no output at all but to
return list of recIDs found. (Suitable for high-level API.).
ot (str):
output only these MARC tags (*e.g.* "100,700,909C0b").
Useful if only some fields are to be shown in the
output, e.g. for library to control some fields.
as (int):
advanced search ("0" means no, "1" means yes).
Whether search was called from within the advanced search
interface.
p1 (str):
first pattern to search for in the advanced search
interface. Much like **p**.
f1 (str):
first field to search within in the advanced search
interface. Much like **f**.
m1 (str):
first matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
op1 (str):
first operator, to join the first and the second unit
in the advanced search interface. ("a" add, "o" or, "n" not).
p2 (str):
second pattern to search for in the advanced search
interface. Much like **p**.
f2 (str):
second field to search within in the advanced search
interface. Much like **f**.
m2 (str):
second matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
op2 (str):
second operator, to join the second and the third unit
in the advanced search interface. ("a" add, "o" or, "n" not).
p3 (str):
third pattern to search for in the advanced search
interface. Much like **p**.
f3 (str):
third field to search within in the advanced search
interface. Much like **f**.
m3 (str):
third matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
sc (int):
split by collection ("0" no, "1" yes).
Governs whether we want to present the results in a single
huge list, or splitted by collection.
jrec (int):
jump to record (*e.g.* "234").
Used for navigation inside the search results.
recid (int):
display record ID (*e.g.* "20000").
Do not search/browse but go straight away to the Detailed
record page for the given recID.
recidb (int):
display record ID bis (*e.g.* "20010").
If greater than "recid", then display records from recid to
recidb. Useful for example for dumping records from the
database for reformatting.
sysno (str):
display old system SYS number (*e.g.* "").
If you migrate to Invenio from another system, and store your
old SYS call numbers, you can use them instead of recid if you
wish so.
id (int):
the same as recid, in case recid is not set.
For backwards compatibility.
idb (int):
the same as recid, in case recidb is not set.
For backwards compatibility.
sysnb (str):
the same as sysno, in case sysno is not set.
For backwards compatibility.
action (str):
action to do. "SEARCH" for searching,
"Browse" for browsing. Default is to search.
d1 (str):
first datetime in full YYYY-mm-dd HH:MM:DD format
(*e.g.* "1998-08-23 12:34:56"). Useful for search limits
on creation/modification date (see "dt" argument below).
Note that "d1" takes precedence over d1y, d1m, d1d if these
are defined.
d1y (int):
first date's year (*e.g.* "1998").
Useful for search limits on creation/modification date.
d1m (int):
first date's month (*e.g.* "08").
Useful for search limits on creation/modification date.
d1d (int):
first date's day (*e.g.* "23").
Useful for search limits on creation/modification date.
d2 (str):
second datetime in full YYYY-mm-dd HH:MM:DD format
(*e.g.* "1998-09-02 12:34:56"). Useful for search limits
on creation/modification date (see "dt" argument below).
Note that "d2" takes precedence over d2y, d2m, d2d
if these are defined.
d2y (int):
second date's year (*e.g.* "1998").
Useful for search limits on creation/modification date.
d2m (int):
second date's month (*e.g.* "09").
Useful for search limits on creation/modification date.
d2d (int):
second date's day (*e.g.* "02").
Useful for search limits on creation/modification date.
dt (str):
first and second date's type (*e.g.* "c").
Specifies whether to search in creation dates ("c") or in
modification dates ("m"). When dt is not set and d1*
and d2* are set, the default is "c".
verbose (int):
verbose level (0=min, 9=max).
Useful to print some internal information on the searching
process in case something goes wrong.
ap (int):
alternative patterns (0=no, 1=yes).
In case no exact match is found, the search engine can try
alternative patterns e.g. to replace non-alphanumeric
characters by a boolean query. ap defines if this is wanted.
......@@ -105,7 +105,7 @@ class InvenioStore(object):
Args:
url (str):
the URL string depends on the store and on the invenio
version which is ruuning, *e.g.*::
version which is running, *e.g.*::
* ``https://cds.cern.ch/record/123456/of=recjson``
* ``https://cds.cern.ch/search?of=id&....
......@@ -115,226 +115,11 @@ class InvenioStore(object):
Keyword Args:
The keyword arguments are those of the invenio web interface.
Details are in https://inspirehep.net/help/hacking/search-engine-api
Examples how to use the old invenio API:
https://inspirehep.net/info/hep/api?ln=fr#json_fnames
The keyword arguments are those of the invenio search engine and
they depend on the version of invenio.
List of keyword in the JSON record:
https://github.com/inspirehep/invenio/blob/prod/modules/bibfield/etc/atlantis.cfg
req (str):
mod_python Request class instance.
cc (str):
current collection (*e.g.* "ATLAS").
The collection the user started to search/browse from.
c (str):
collection list (*e.g.* ["Theses", "Books"]).
The collections user may have selected/deselected when
starting to search from **cc**.
ec (str):
external collection list (*e.g.* ["CiteSeer", "Google"]).
The external collections may have been selected/deselected
by the user.
p (str):
pattern to search for (*e.g.* "ellis and muon or kaon").
f (str):
field to search within (*e.g.* "author").
rg (int):
records in groups of (*e.g.* "10").
Defines how many hits per collection in the search results
page are displayed.
sf (str):
sort field (*e.g*. "title").
so (str):
sort order ("a"=ascending, "d"=descending).
sp (str):
sort pattern (*e.g.* "CERN-") -- in case there are more
values in a sort field, this argument tells which one
to prefer.
rm (str):
ranking method (*e.g.* "jif").
Defines whether results should be ranked by some known
ranking method.
of (str):
output format (*e.g.* "hb").
Usually starting "h" means HTML output (and "hb" for HTML
brief, "hd" for HTML detailed), "x" means XML output,
"t" means plain text output, "id" means no output at all but to
return list of recIDs found. (Suitable for high-level API.).
ot (str):
output only these MARC tags (*e.g.* "100,700,909C0b").
Useful if only some fields are to be shown in the
output, e.g. for library to control some fields.
as (int):
advanced search ("0" means no, "1" means yes).
Whether search was called from within the advanced search
interface.
p1 (str):
first pattern to search for in the advanced search
interface. Much like **p**.
f1 (str):
first field to search within in the advanced search
interface. Much like **f**.
m1 (str):
first matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
op1 (str):
first operator, to join the first and the second unit
in the advanced search interface. ("a" add, "o" or, "n" not).
p2 (str):
second pattern to search for in the advanced search
interface. Much like **p**.
f2 (str):
second field to search within in the advanced search
interface. Much like **f**.
m2 (str):
second matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
op2 (str):
second operator, to join the second and the third unit
in the advanced search interface. ("a" add, "o" or, "n" not).
p3 (str):
third pattern to search for in the advanced search
interface. Much like **p**.
f3 (str):
third field to search within in the advanced search
interface. Much like **f**.
m3 (str):
third matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact phrase,
"p" partial phrase, "r" regular expression).
sc (int):
split by collection ("0" no, "1" yes).
Governs whether we want to present the results in a single
huge list, or splitted by collection.
jrec (int):
jump to record (*e.g.* "234").
Used for navigation inside the search results.
recid (int):
display record ID (*e.g.* "20000").
Do not search/browse but go straight away to the Detailed
record page for the given recID.
recidb (int):
display record ID bis (*e.g.* "20010").
If greater than "recid", then display records from recid to
recidb. Useful for example for dumping records from the
database for reformatting.
sysno (str):
display old system SYS number (*e.g.* "").
If you migrate to Invenio from another system, and store your
old SYS call numbers, you can use them instead of recid if you
wish so.
id (int):
the same as recid, in case recid is not set.
For backwards compatibility.
idb (int):
the same as recid, in case recidb is not set.
For backwards compatibility.
sysnb (str):
the same as sysno, in case sysno is not set.
For backwards compatibility.
action (str):
action to do. "SEARCH" for searching,
"Browse" for browsing. Default is to search.
d1 (str):
first datetime in full YYYY-mm-dd HH:MM:DD format
(*e.g.* "1998-08-23 12:34:56"). Useful for search limits
on creation/modification date (see "dt" argument below).
Note that "d1" takes precedence over d1y, d1m, d1d if these
are defined.
d1y (int):
first date's year (*e.g.* "1998").
Useful for search limits on creation/modification date.
d1m (int):
first date's month (*e.g.* "08").
Useful for search limits on creation/modification date.
d1d (int):
first date's day (*e.g.* "23").
Useful for search limits on creation/modification date.
d2 (str):
second datetime in full YYYY-mm-dd HH:MM:DD format
(*e.g.* "1998-09-02 12:34:56"). Useful for search limits
on creation/modification date (see "dt" argument below).
Note that "d2" takes precedence over d2y, d2m, d2d
if these are defined.
d2y (int):
second date's year (*e.g.* "1998").
Useful for search limits on creation/modification date.
d2m (int):
second date's month (*e.g.* "09").
Useful for search limits on creation/modification date.
d2d (int):
second date's day (*e.g.* "02").
Useful for search limits on creation/modification date.
dt (str):
first and second date's type (*e.g.* "c").
Specifies whether to search in creation dates ("c") or in
modification dates ("m"). When dt is not set and d1*
and d2* are set, the default is "c".
verbose (int):
verbose level (0=min, 9=max).
Useful to print some internal information on the searching
process in case something goes wrong.
ap (int):
alternative patterns (0=no, 1=yes).
In case no exact match is found, the search engine can try
alternative patterns e.g. to replace non-alphanumeric
characters by a boolean query. ap defines if this is wanted.
ln (str):
language of the search interface (*e.g.* "en").
Useful for internationalization.
timeout (float):
timeout for the HTTP request
See https://gitlab.in2p3.fr/limbra/limbra/-/blob/master/modules/invenio_tools/README.md
for more information.
Returns:
requests.Response:
......@@ -354,74 +139,13 @@ class InvenioStore(object):
def get_ids(self, **kwargs):
"""Return a list of *record id* matching search criteria.
Search criteria are defined by the keywords arguments.
The complete list of keyword arguments can be found at
https://inspirehep.net/help/hacking/search-engine-api
Examples how to use the invenio API:
https://inspirehep.net/info/hep/api?ln=fr#json_fnames
List of keyword in the JSON record:
https://github.com/inspirehep/invenio/blob/prod/modules/bibfield/etc/atlantis.cfg
Keyword Args:
cc (str):
current collection (e.g. "ATLAS Papers").
The collection the user started to search/browse from.
p (str):
pattern to search for (e.g. "ellis and muon or kaon").
f (str):
field to search within (e.g. "author").
p1 (str):
first pattern to search for in the advanced search
interface. Much like **p**.
f1 (str):
first field to search within in the advanced search
interface. Much like **f**.
m1 (str):
first matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact
phrase, "p" partial phrase, "r" regular expression).
op1 (str):
first operator, to join the first and the second unit
in the advanced search interface. ("a" add, "o" or, "n" not).
p2 (str): s
econd pattern to search for in the advanced search
interface. Much like **p**.
f2 (str):
second field to search within in the advanced search
interface. Much like **f**.
m2 (str):
second matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact
phrase, "p" partial phrase, "r" regular expression).
op2 (str):
second operator, to join the second and the third unit
in the advanced search interface. ("a" add, "o" or,"n" not).
p3 (str):
third pattern to search for in the advanced search
interface. Much like **p**.
f3 (str):
third field to search within in the advanced search
interface. Much like **f**.
The keyword arguments are those of the invenio search engine and
they depend on the version of invenio.
m3 (str):
third matching type in the advanced search interface.
("a" all of the words, "o" any of the words, "e" exact
phrase, "p" partial phrase, "r" regular expression).
See https://gitlab.in2p3.fr/limbra/limbra/-/blob/master/modules/invenio_tools/README.md
for more information.
Returns:
list:
......@@ -431,9 +155,10 @@ class InvenioStore(object):
Raises:
CdsException::
* Method not implemented for the selected store, shelf pair;
* keyword argument is invalid;
* the server return an HTTP error;
* JSON object can't be decoded
* JSON object can't be decoded;
* not well formed list of ids.
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment