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

version» Context lines:

pike.git/lib/modules/Search.pmod/Query.pmod:1:   // This file is part of Roxen Search   // Copyright © 2001 Roxen IS. All rights reserved.   // - // $Id: Query.pmod,v 1.17 2001/07/04 20:42:20 nilsson Exp $ + // $Id: Query.pmod,v 1.18 2001/07/05 00:47:58 nilsson Exp $    - static function(string:string) blobfeeder(Search.Database.Base db, array words) + static function(string,int:string) blobfeeder(Search.Database.Base db, array words)   {    mapping state = mkmapping(words,allocate(sizeof(words))); -  return lambda( string word ) +  return lambda( string word, int foo )    {    return db->get_blob(word, state[word]++);    };   }      static array(string) uniq_preserve_order(array(string) a) {    array(string) result = ({});    foreach (a, string s)    if (search(result, s) < 0)    result += ({ s });    return result;   }      Search.ResultSet do_query_or(Search.Database.Base db,    array(string) words,    Search.RankingProfile ranking)   { - // Search.ResultSet result = - // _WhiteFish.do_query_or(words, - // ranking->field_ranking, - // ranking->proximity_ranking, - // ranking->cutoff, - // blobfeeder(db, words)); - // werror("do_query_or(%{ %O %}) => %d hits\n", words, result->size()); - // return result; +  Search.ResultSet result = +  _WhiteFish.do_query_or(words, +  ranking->field_ranking, +  ranking->proximity_ranking, +  ranking->cutoff, +  blobfeeder(db, words)); +  werror("do_query_or(%{ %O %}) => %d hits\n", words, result->size()); +  return result;   }      Search.ResultSet do_query_and(Search.Database.Base db,    array(string) words,    Search.RankingProfile ranking)   { - // Search.ResultSet result = - // _WhiteFish.do_query_and(words, - // ranking->field_ranking, - // ranking->proximity_ranking, - // ranking->cutoff, - // blobfeeder(db, words)); - // werror("do_query_and(%{ %O %}) => %d hits\n", words, result->size()); - // return result; +  Search.ResultSet result = +  _WhiteFish.do_query_and(words, +  ranking->field_ranking, +  ranking->proximity_ranking, +  ranking->cutoff, +  blobfeeder(db, words)); +  werror("do_query_and(%{ %O %}) => %d hits\n", words, result->size()); +  return result;   }      Search.ResultSet do_query_phrase(Search.Database.Base db,    array(string) words,    Search.RankingProfile ranking)   { - // Search.ResultSet result = - // _WhiteFish.do_query_phrase(words, - // ranking->field_ranking, - // // ranking->cutoff, - // blobfeeder(db, words)); - // werror("do_query_phrase(%{ %O %}) => %d hits\n", words, result->size()); - // return result; +  Search.ResultSet result = +  _WhiteFish.do_query_phrase(words, +  ranking->field_ranking, +  // ranking->cutoff, +  blobfeeder(db, words)); +  werror("do_query_phrase(%{ %O %}) => %d hits\n", words, result->size()); +  return result;   }      //! @param query   //! The query string entered by user.   //! @param db   //! The search database.   //! @param defaultRanking   //! Used when searching in the field "any:".   //!   //! @returns