Skip to content
Extraits de code Groupes Projets
Valider 43c257be rédigé par Fil's avatar Fil
Parcourir les fichiers

indexer les forums et les signatures pour de vrai (avec du contenu !)

et permettre de les retrouver dans les boucles
parent 9db9f546
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -191,6 +191,31 @@ function indexer_objet($type, $id_objet, $forcer_reset = true, $full = true /* f ...@@ -191,6 +191,31 @@ function indexer_objet($type, $id_objet, $forcer_reset = true, $full = true /* f
} }
break; break;
case 'forum':
$query = "SELECT * FROM spip_forum WHERE id_forum=$id_objet";
$result = spip_query($query);
while($row = spip_fetch_array($result)){
indexer_chaine($row['titre'], 3);
indexer_chaine($row['texte'], 1);
indexer_chaine($row['auteur'], 2);
indexer_chaine($row['email_auteur'], 2);
indexer_chaine($row['nom_site'], 2);
indexer_chaine($row['url_site'], 1);
}
break;
case 'signature':
$query = "SELECT * FROM spip_signatures WHERE id_signature=$id_objet";
$result = spip_query($query);
while($row = spip_fetch_array($result)){
indexer_chaine($row['nom_email'], 2);
indexer_chaine($row['ad_email'], 2);
indexer_chaine($row['nom_site'], 2);
indexer_chaine($row['url_site'], 1);
indexer_chaine($row['message'], 1);
}
break;
case 'syndic': case 'syndic':
$query = "SELECT * FROM spip_syndic WHERE id_syndic=$id_objet"; $query = "SELECT * FROM spip_syndic WHERE id_syndic=$id_objet";
$result = spip_query($query); $result = spip_query($query);
...@@ -296,7 +321,12 @@ function effectuer_une_indexation($nombre_indexations = 1) { ...@@ -296,7 +321,12 @@ function effectuer_une_indexation($nombre_indexations = 1) {
break; break;
} }
$s = spip_query("SELECT id_$type, idx FROM $table_objet WHERE idx IN ('','1') $critere LIMIT 0,$nombre_indexations"); if ($type == 'syndic')
$limit = 1;
else
$limit = $nombre_indexations;
$s = spip_query("SELECT id_$type, idx FROM $table_objet WHERE idx IN ('','1','idx') $critere ORDER BY (idx='idx') LIMIT 0,$limit");
while ($t = spip_fetch_array($s)) { while ($t = spip_fetch_array($s)) {
$vu[$type] .= $t[0].", "; $vu[$type] .= $t[0].", ";
indexer_objet($type, $t[0], $t[1]); indexer_objet($type, $t[0], $t[1]);
......
...@@ -290,12 +290,13 @@ function parser_boucle($texte, $id_parent) { ...@@ -290,12 +290,13 @@ function parser_boucle($texte, $id_parent) {
$total_parties = $match[2]; $total_parties = $match[2];
} }
else if ($param == 'recherche') { else if ($param == 'recherche') {
if ($type == 'syndication') $req_from[] = "spip_index_syndic AS idx"; if ($type == 'syndication') $req_from[] = "spip_index_syndic AS rec";
else $req_from[] = "spip_index_$type AS idx"; else if ($type == 'forums') $req_from[] = "spip_index_forum AS rec";
$req_select[] = "SUM(idx.points + 100*(idx.hash IN (\$hash_recherche_strict))) AS points"; else $req_from[] = "spip_index_$type AS rec";
$req_where[] = "idx.$id_objet=$table.$id_objet"; $req_select[] = "SUM(rec.points + 100*(rec.hash IN (\$hash_recherche_strict))) AS points";
$req_where[] = "rec.$id_objet=$table.$id_objet";
$req_group = " GROUP BY $table.$id_objet"; $req_group = " GROUP BY $table.$id_objet";
$req_where[] = "idx.hash IN (\$hash_recherche)"; $req_where[] = "rec.hash IN (\$hash_recherche)";
} }
else $params2[] = $param; else $params2[] = $param;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter