def timestamp_verifier(self):
        """
        Return the time at which the data was last updated.  If the
        value returned by the function is newer than the cache, the
        cache will be invalidated.

        @return: string-formatted time '%Y-%m-%d %H:%M:%S'
        """
        return max(get_table_update_time('collectionname'),
                   get_table_update_time('collection_collection'))
    def timestamp_verifier(self):
        """
        Return the time at which the data was last updated.  If the
        value returned by the function is newer than the cache, the
        cache will be invalidated.

        @return: string-formatted time '%Y-%m-%d %H:%M:%S'
        """
        return max(get_table_update_time('collectionname'),
                   get_table_update_time('collection_collection'))
Ejemplo n.º 3
0
    def timestamp_verifier(self):
        """Return the time at which the data was last updated.

        If the value returned by the function is newer than the cache, the
        cache will be invalidated.

        :return: string-formatted time ``'%Y-%m-%d %H:%M:%S'``
        """
        # This is an approximation...
        return get_table_update_time('knwKBRVAL')
Ejemplo n.º 4
0
    def timestamp_verifier(self):
        """Return the time at which the data was last updated.

        If the value returned by the function is newer than the cache, the
        cache will be invalidated.

        :return: string-formatted time ``'%Y-%m-%d %H:%M:%S'``
        """
        # This is an approximation...
        return get_table_update_time('knwKBRVAL')
Ejemplo n.º 5
0
def calculate_index_term_count(config):
    """Calculate the weight of a record set based on number of enries of a
    tag from the record in another index...useful for authority files"""

    records = []

    if config.has_section("index_term_count"):
        index = config.get("index_term_count", "index_table_name")
        tag = config.get("index_term_count", "index_term_value_from_tag")
        # check against possible SQL injection:
        dummy = get_table_update_time(index)
        tag = wash_table_column_name(tag)
    else:
        raise Exception("Config file " + config +
                        " does not have index_term_count section")
        return ()

    task_sleep_now_if_required(can_stop_too=True)
    write_message("......Processing all records")
    query = "SELECT id_bibrec, value FROM bib%sx, bibrec_bib%sx WHERE tag=%%s AND id_bibxxx=id" % \
            (tag[0:2], tag[0:2]) # we checked that tag is safe
    records = list(run_sql(query, (tag, )))
    write_message("Number of records found with the necessary tags: %s" %
                  len(records))

    rnkset = {}
    for key, value in records:
        hits = 0
        if len(value):
            query = "SELECT hitlist from %s where term = %%s" % index  # we checked that index is a table
            row = run_sql(query, (value, ))
            if row and row[0] and row[0][0]:
                #has to be prepared for corrupted data!
                try:
                    hits = len(intbitset(row[0][0]))
                except:
                    hits = 0
        rnkset[key] = hits
    write_message("Number of records available in rank method: %s" %
                  len(rnkset))
    return rnkset
Ejemplo n.º 6
0
def calculate_index_term_count(config):
    """Calculate the weight of a record set based on number of enries of a
    tag from the record in another index...useful for authority files"""

    records = []

    if config.has_section("index_term_count"):
        index = config.get("index_term_count","index_table_name")
        tag = config.get("index_term_count","index_term_value_from_tag")
        # check against possible SQL injection:
        dummy = get_table_update_time(index)
        tag = wash_table_column_name(tag)
    else:
        raise Exception("Config file " + config + " does not have index_term_count section")
        return()

    task_sleep_now_if_required(can_stop_too=True)
    write_message("......Processing all records")
    query = "SELECT id_bibrec, value FROM bib%sx, bibrec_bib%sx WHERE tag=%%s AND id_bibxxx=id" % \
            (tag[0:2], tag[0:2]) # we checked that tag is safe
    records = list(run_sql(query, (tag,)))
    write_message("Number of records found with the necessary tags: %s" % len(records))


    rnkset = {}
    for key, value in records:
        hits = 0
        if len(value):
            query = "SELECT hitlist from %s where term = %%s" % index # we checked that index is a table
            row = run_sql(query, (value,))
            if row and row[0] and row[0][0]:
                #has to be prepared for corrupted data!
                try:
                    hits = len(intbitset(row[0][0]))
                except:
                    hits = 0
        rnkset[key] = hits
    write_message("Number of records available in rank method: %s" % len(rnkset))
    return rnkset
Ejemplo n.º 7
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return max(get_table_update_time('collection'),
                get_table_update_time('collection_collection'))
Ejemplo n.º 8
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return get_table_update_time('collectionname')
Ejemplo n.º 9
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return max(get_table_update_time('accROLE_accACTION_accARGUMENT'),
                get_table_update_time('accARGUMENT'))
Ejemplo n.º 10
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return get_table_update_time('idxINDEX')
Ejemplo n.º 11
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return max(get_table_update_time('accROLE_accACTION_accARGUMENT'),
                get_table_update_time('accARGUMENT'))
Ejemplo n.º 12
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return max(get_table_update_time('collection'),
                get_table_update_time('collection_collection'))
Ejemplo n.º 13
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return get_table_update_time('collectionname')
Ejemplo n.º 14
0
 def timestamp_verifier():
     """The standard timestamp verifier is looking at affected
     tables time stamp."""
     return max([get_table_update_time(table)
         for table in self.affected_tables])
Ejemplo n.º 15
0
 def timestamp_verifier():
     """The standard timestamp verifier is looking at affected
     tables time stamp."""
     return max([get_table_update_time(table)
         for table in self.affected_tables])
Ejemplo n.º 16
0
 def timestamp_verifier():
     from invenio.legacy.dbquery import get_table_update_time
     return get_table_update_time('idxINDEX')