pike.git / lib / modules / Search.pmod / Utils.pmod

version» Context lines:

pike.git/lib/modules/Search.pmod/Utils.pmod:116:    get_database(),    get_query_value("fi_rank"));    return ranking;    }       class ADTSet {    private mapping vals = ([]);       ADTSet add (string|int|float in) {    vals[in] = 1; -  return this_object(); +  return this;    }       ADTSet sub (string|int|float out) {    m_delete(vals, out); -  return this_object(); +  return this;    }       ADTSet `+(mixed in) {    if(stringp(in)||intp(in)||floatp(in))    add(in);    else    map((array)in, add); -  return this_object(); +  return this;    }       ADTSet `-(mixed out) {    if(stringp(out)||intp(out)||floatp(out))    sub(out);    else    map((array)out, sub); -  return this_object(); +  return this;    }    -  mixed cast(string to) { +  protected mixed cast(string to) {    switch(to) { -  case "object": return this_object(); +     case "array": return indices(vals);    case "multiset": return (multiset)indices(vals);    default: -  error("Can not cast ADTSet to "+to+".\n"); +  return UNDEFINED;    }    }    }       //! Returns a cached array of stop words for the current query profile.    array(string) get_stop_words() {    if(!stop_words) {    ADTSet words = ADTSet();    foreach(get_query_value("sw_lists"), string fn) {    string file = Stdio.read_file(fn);
pike.git/lib/modules/Search.pmod/Utils.pmod:373:    int db = get_db_profile_number(db_name);    int query = get_query_profile_number(query_name);       ProfileEntry entry;    if(entry=entry_cache[query +":"+ db]) {    if(!entry->check_timeout()) return entry;    if(up_to_datep(db) &&    up_to_datep(query)) return entry;    }    -  entry = ProfileEntry( db, query, this_object() ); +  entry = ProfileEntry( db, query, this );    return entry_cache[query +":"+ db] = entry;    }       //! Flushes profile entry @[p] from the profile cache.    void flush_profile(int p) {    m_delete(value_cache, p);    foreach(db_profile_names; string name; int dbp)    if (dbp == p)    m_delete(db_profile_names, name);    foreach(query_profile_names; string name; int qp)
pike.git/lib/modules/Search.pmod/Utils.pmod:710:    "extra varchar(255))");    }       void werror_event( int code, string type, void|string extra, void|int log_profile )    {    mapping types = ([ "error" : "Error",    "warning" : "Warning",    "notice" : "Notice", ]);       werror(sprintf("%sSearch: %s: %s\n", -  " : ", +  " : ",    types[type],    extra?sprintf(codes[(int)code], @(extra/"\n")):codes[(int)code]));    }       void log_purge(int days)    {    Sql.Sql db = get_db();    if(!db) return;    int t1 = time();    if (t1 < last_log_purge_time + log_purge_freq) return;
pike.git/lib/modules/Search.pmod/Utils.pmod:738:    int t2 = time();    if (t2 - t1 > 10) // More than 10 s is somewhat slow, report warning.    report_warning("Search log purge took %d s.\n", t2-t1);    }       //!    void log_event( int code, string type, void|string extra, void|int log_profile ) {    Sql.Sql db = get_db();    if(!db) return;    -  if(zero_type(log_profile)) +  if(undefinedp(log_profile))    log_profile = profile;       if(stderr_logging)    werror_event(code, type, extra, log_profile);       if(extra)    db->query("INSERT INTO eventlog (profile,code,type,extra) VALUES (%d,%d,%s,%s)",    log_profile, code, type, extra);    else    db->query("INSERT INTO eventlog (profile, code,type) VALUES (%d,%d,%s)",