Invenio 1: BibRank exception

I was getting several exceptions in Bibrank:

* 2015-01-15 08:32:17 -> NoOptionError: No option 'citation_loss_limit' in section: 'citation' (ConfigParser.py:618:get)

** User details
No client information available

** Traceback details 

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/invenio/bibtask.py", line 606, in task_init
    ret = _task_run(task_run_fnc)
  File "/usr/lib64/python2.7/site-packages/invenio/bibtask.py", line 1146, in _task_run
    if callable(task_run_fnc) and task_run_fnc():
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank.py", line 159, in task_run_core
    func_object(key)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 443, in citation
    return bibrank_engine(run)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 356, in bibrank_engine
    func_object(rank_method_code, cfg_name, config)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 68, in citation_exec
    dic, index_update_time = get_citation_weight(rank_method_code, config)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_citation_indexer.py", line 141, in get_citation_weight
    weights = process_and_store(updated_recids, config, chunk_size)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_citation_indexer.py", line 157, in process_and_store
    citation_loss_limit = int(config.get(function, "citation_loss_limit"))
  File "/usr/lib64/python2.7/ConfigParser.py", line 618, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'citation_loss_limit' in section: 'citation'

** Stack frame details

This was solved by updating /opt/invenio/etc/bibrank/citation.cfg with citation_loss_limit = 50 and I also included some more options:

[...]
reference_via_doi= 999C5a
reference_via_record_id= 990C50
reference_via_isbn= 999C5i
[...]
citation_loss_limit = 50
collections =

Then it was solved 🙂

Invenio 1 API: list all restricted records and (restricted/public) collections

Let’s take a quick look at some of the functions provided by Invenio1 search_engine API:

Get all the collection names…

>>> import invenio.search_engine
>>> collection_reclist_cache = invenio.search_engine.CollectionRecListDataCacher()
>>> print collection_reclist_cache.cache.keys()

Get all the restricted collections (the ones which have access restrictions configured via webaccess-viewrestrcoll authorizations

>>> import invenio.search_engine
>>> restricted_collection_cache = invenio.search_engine.RestrictedCollectionDataCacher()
>>> print restricted_collection_cache.cache

Get all the records which belong to restricted collections

>>> import invenio.search_engine
>>> restricted_collection_cache = invenio.search_engine.RestrictedCollectionDataCacher()
>>> for collection in restricted_collection_cache.cache:
...      print "Coleccion: '%s'" %collection
...      print "Registros: '%s'" %str(repr(invenio.search_engine.get_collection_reclist(collection)))