Exemplo n.º 1
0
 def get_records_for_user(qid, uid):
     from invenio.legacy.search_engine import \
         get_records_that_can_be_displayed
     key = get_search_results_cache_key_from_qid(qid)
     data = search_results_cache.get(key)
     if data is None:
         return intbitset([])
     cc = search_results_cache.get(key + '::cc')
     return get_records_that_can_be_displayed(current_user,
                                              intbitset().fastload(data),
                                              cc)
Exemplo n.º 2
0
 def get_records_for_user(qid, uid):
     from invenio.legacy.search_engine import \
         get_records_that_can_be_displayed
     key = get_search_results_cache_key_from_qid(qid)
     data = search_results_cache.get(key)
     if data is None:
         return intbitset([])
     cc = search_results_cache.get(key + '::cc')
     return get_records_that_can_be_displayed(current_user,
                                              intbitset().fastload(data),
                                              cc)
Exemplo n.º 3
0
def oai_get_recid(identifier):
    """Returns the recid corresponding to the OAI identifier. Prefer a non deleted
    record if multiple recids matches but some of them are deleted (e.g. in
    case of merging). Returns None if no record matches."""
    if identifier:
        recids = search_pattern(p=identifier, f=CFG_OAI_ID_FIELD, m='e', ap=-9)
        if recids:
            displayable_recids = get_records_that_can_be_displayed(current_user, recids)
            for recid in displayable_recids:
                if record_exists(recid) > 0:
                    return recid
    return None
Exemplo n.º 4
0
def oai_get_recid(identifier):
    """Returns the recid corresponding to the OAI identifier. Prefer a non deleted
    record if multiple recids matches but some of them are deleted (e.g. in
    case of merging). Returns None if no record matches."""
    if identifier:
        recids = search_pattern(p=identifier, f=CFG_OAI_ID_FIELD, m='e', ap=-9)
        if recids:
            displayable_recids = get_records_that_can_be_displayed(current_user, recids)
            for recid in displayable_recids:
                if record_exists(recid) > 0:
                    return recid
    return None