def METHOD_NAME(sender, json=None, record=None, index=None,
                        doc_type=None, arguments=None, **dummy_kwargs):
    """Signal sent before a record is indexed.
    :param json: The dumped record dictionary which can be modified.
    :param record: The record being indexed.
    :param index: The index in which the record will be indexed.
    :param doc_type: The doc_type for the record.
    """
    if index.split('-')[0] == HoldingsSearch.Meta.index:
        library_pid = None
        organisation_pid = None
        holding = next(HoldingsSearch()
                       .filter('term', pid=record.pid)
                       .source('holdings_type').scan(), None)
        # get the number of items for ui paging
        item_search = ItemsSearch()[0:0]\
            .filter('term', holding__pid=record.pid)
        if holding is not None and holding["holdings_type"] == 'serial':
            item_search = ItemsSearch()[0:0]\
                .filter('term', holding__pid=record.pid)\
                .filter('term', issue__status="received")
        # to compute the number of masked item
        item_search.aggs.bucket('public_items', 'terms', field='_masked')
        results = item_search.source(['organisation', 'library']).execute()
        # number of items
        json['items_count'] = results.hits.total.value
        # number of masked items
        number_of_masked_items = 0
        for bucket in results.aggregations.public_items.buckets:
            if bucket.key_as_string == 'true':
                number_of_masked_items = bucket.doc_count
                break
        json['public_items_count'] = \
            json['items_count'] - number_of_masked_items