Comment creer un moteur de recherche

MESTIRI -  
 cOcKeR -
Bonsoir,

Je me suis fixé l'idée de commencer à developper un moteur de recherche, mais je n'ai aucune idée sur les algorithmes. J'ai cherché sur internet, mais je n'ai rien trouvé de concret .

Est ce quelqu'un peut m'orienter un peu et me donner une idée sur la proggrammation (algorithme, outils,...)

Merci beaucoup d'avance pour votre amabilité.

2 réponses

  1. cOcKeR
     
    é bien mon petit voici un code en javascript rien que pour toi ;

    1°-Ouvre le Bloc-Notes

    2°-Copier/Coller le code :

                             MOTEUR DE RECHERCHE
    <script language="JavaScript">
    // Script by Cocker 
    // a mettre entre <HEAD> et </HEAD>
    var MAX_ENGINES = 30;
    var SNARK_STRING = "officiel+net";
    
    function MakeArray(n) {
    for (var i = 1; i <= n; i++) {
    this[i] = 0;
    }
    this.maxlen = n;
    this.len = 0;
    return this;
    }
    
    var engs = new MakeArray(MAX_ENGINES);
    
    function find_substring(needle, haystack) {
    var i, needlen = needle.length, haylen = haystack.length;
    for (i=0; i<=haylen-needlen; i++) {
    if (needle == haystack.substring(i,i+needlen))
    return i;
    }
    return false;
    }
    
    function Engine(name, opts, home, search) {
    var snark = find_substring(SNARK_STRING, search);
    this.name = name;
    this.opts = opts;
    this.home = home;
    this.pre_snark = search.substring(0,snark);
    this.post_snark= search.substring(snark+SNARK_STRING.length, search.length);
    }
    
    function Add(name, opts, home, search) {
    engs.len++;
    if (engs.len <= engs.maxlen) {
    engs[engs.len] = new Engine(name, opts, home, search)
    }
    else {
    alert("Better increase MAX_ENGINES: " + engs.len + ">" + engs.maxlen)
    }
    }
    
    
    Add("AltaVista", "SELECTED",
    "http://altavista.digital.com/",
    "http://altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=d&q=officiel+net" );
    
    Add("Yahoo!", "",
    "http://www.yahoo.com/",
    "http://search.yahoo.com/bin/search?p=officiel+net" );
    
    function HandleForm(form) {
    form.submit(); 
    var i, oldq=form.query.value, newq="";
    for (i=0; i<oldq.length; i++) { // compress [ ]+ into \+
    var thischar = oldq.charAt(i);
    if (thischar != ' ')
    newq += thischar;
    else if (lastchar != ' ')
    newq += '+';
    lastchar = thischar;
    }
    var eng = engs[1+form.service.selectedIndex];
    location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;
    }
    
    function DisplayForm() {
    document.writeln('<CENTER><FORM OnSubmit="HandleForm(this); return false">');
    document.writeln('Avec <SELECT name="service">');
    for (i=1; i <= engs.len; i++) {
    document.writeln("<OPTION " + engs[i].opts + "> " + engs[i].name);
    }
    document.writeln('</SELECT> rechercher <INPUT size=26 name="query">');
    document.writeln('<input type=submit value=" GO!">');
    document.writeln('</FORM> </CENTER>');
    }
    
    DisplayForm();
    
    </script>
    

    Enregistre le avec lextension .html ou .htm
    par exemple essay.htm

    bonne chance pour la suite !

    cOcKeR
    0