예제 #1
0
def get_field_tags(field, tagtype="marc"):
    """Returns a list of tags for the field code 'field'.

    Example: field='author', output=['100__%','700__%'].
    """
    from invenio_search.models import Field
    return list(Field.get_field_tags(field, tagtype=tagtype))
예제 #2
0
def get_field_tags(field, tagtype="marc"):
    """Returns a list of tags for the field code 'field'.

    Example: field='author', output=['100__%','700__%'].
    """
    from invenio_search.models import Field
    return list(Field.get_field_tags(field, tagtype=tagtype))
예제 #3
0
def references_nb_counts():
    """Get number of references for the record `recid`."""
    recid = request.view_args.get('recid')
    if recid is None:
        return

    from invenio.legacy.bibrecord import record_get_field_instances
    from invenio_search.models import Field

    from .api import get_record

    if not cfg['CFG_CERN_SITE']:
        reftag = ""
        reftags = list(Field.get_field_tags("reference"))
        if reftags:
            reftag = reftags[0]
        tmprec = get_record(recid)
        if reftag and len(reftag) > 4:
            return len(record_get_field_instances(tmprec, reftag[0:3],
                       reftag[3], reftag[4]))
    return 0