Seite 1 von 1

Problem mit der Volltextsuche

Verfasst: Fr 16. Apr 2004, 21:20
von Halchteranerin
Hallo,

ich benutze die Volltextsuche, die ich unter http://www.contenido.de/forum/viewtopic.php?t=3241 gefunden hatte. Genauer genommen habe ich zwei Module, Volltextsuche-Eingabe und Volltextsuche-Ausgabe, die folgendermassen aussehen:

Volltextsuche-Eingabe:
Input:

Code: Alles auswählen

echo "
<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\">
  <tr valign=\"top\">
    <td width=\"202\">Schriftart Link:</td>
    <td><select name=\"CMS_VAR[0]\" size=\"1\">";
    
	if ("CMS_VALUE[0]" != 0) {
		echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
	} else {
		echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
	}
    
	for ($i=1; $i<=50; $i++) {
		if ( $i != "CMS_VALUE[0]" ) {
			echo "<option value=\"$i\">Font $i</option>";
		} else {
			echo "<option value=\"$i\" selected>Font $i</option>";
		}
	}
    
	echo "
	</SELECT></td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Schriftart Text:</td>
    <td><select name=\"CMS_VAR[1]\" size=\"1\">";
    
	if ("CMS_VALUE[1]" != 0) {
		echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
	} else {
		echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
	}
	
    for ($i=1; $i<=50; $i++) {
		if ( $i != "CMS_VALUE[1]" ) {
			echo "<option value=\"$i\">Font $i</option>";
		} else {
			echo "<option value=\"$i\" selected>Font $i</option>";
		}
	}
	
    echo "
	</SELECT></td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Zusatzangaben: </td>
    <td><INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"0\" ";
	
    if("CMS_VALUE[2]" == 0) { 
		echo "checked=checked"; 
	}
	echo "> nichts <br>
    <INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"1\" ";
    
	if("CMS_VALUE[2]" == 1) { 
		echo "checked=checked"; 
	} 
	echo "> Kommentar <br>
    <INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"2\" ";
    
	if("CMS_VALUE[2]" == 2) { 
		echo "checked=checked"; 
	} 
	echo "> Textausschnitt </td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Linkziel: </td>
    <td><INPUT TYPE=\"text\" NAME=\"CMS_VAR[3]\" VALUE=\"CMS_VALUE[3]\"></td>
  </tr>
</table>";
Output:

Code: Alles auswählen

<?php 
echo " 
<table width=\"140\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> 
<tr><td align=\"left\"> 
<form name='suche' method='POST' action='front_content.php?idcat=100'> 
<input type=\"text\" size=\"\" class=\"feld\" name=\"suche\" value=\"$suche\"></td></tr> 
<tr><td align=\"left\" height=\"21\"> 
<button name=\"s\" type=\"submit\" value=\"Suchen\" size=\"2\" style=\"width: 100px;height:20px; color: white; border:0;background-color:#4779a0;\">Volltextsuche</button></FORM></td></tr></table>"; 
?>
Volltextsuche-Ausgabe:
Input:

Code: Alles auswählen

echo "
<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\">
  <tr valign=\"top\">
    <td width=\"202\">Schriftart Link:</td>
    <td><select name=\"CMS_VAR[0]\" size=\"1\">";
    
	if ("CMS_VALUE[0]" != 0) {
		echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
	} else {
		echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
	}
    
	for ($i=1; $i<=50; $i++) {
		if ( $i != "CMS_VALUE[0]" ) {
			echo "<option value=\"$i\">Font $i</option>";
		} else {
			echo "<option value=\"$i\" selected>Font $i</option>";
		}
	}
    
	echo "
	</SELECT></td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Schriftart Text:</td>
    <td><select name=\"CMS_VAR[1]\" size=\"1\">";
    
	if ("CMS_VALUE[1]" != 0) {
		echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
	} else {
		echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
	}
	
    for ($i=1; $i<=50; $i++) {
		if ( $i != "CMS_VALUE[1]" ) {
			echo "<option value=\"$i\">Font $i</option>";
		} else {
			echo "<option value=\"$i\" selected>Font $i</option>";
		}
	}
	
    echo "
	</SELECT></td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Zusatzangaben: </td>
    <td><INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"0\" ";
	
    if("CMS_VALUE[2]" == 0) { 
		echo "checked=checked"; 
	}
	echo "> nichts <br>
    <INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"1\" ";
    
	if("CMS_VALUE[2]" == 1) { 
		echo "checked=checked"; 
	} 
	echo "> Zusammenfassung <br>
    <INPUT TYPE=\"radio\" NAME=\"CMS_VAR[2]\" VALUE=\"2\" ";
    
	if("CMS_VALUE[2]" == 2) { 
		echo "checked=checked"; 
	} 
	echo "> Textausschnitt </td>
  </tr>  <tr valign=\"top\">
    <td width=\"202\">Linkziel: </td>
    <td><INPUT TYPE=\"text\" NAME=\"CMS_VAR[3]\" VALUE=\"CMS_VALUE[3]\"></td>
  </tr>
</table>";
Output:

Code: Alles auswählen

<?php 
echo "<table border=0 cellpadding=0 cellspacing=0><tr>"; 
if($suche){ 
$suche = trim($suche); 
$suchregexp = "(".str_replace(" ",")|(",$suche).")"; 
$s=ereg_replace("ü", "%FC",strtolower($suche)); 
$s=ereg_replace("ä", "%E4",$s); 
$s=ereg_replace("ö", "%F6",$s); 
$s=ereg_replace("ß", "%DF",$s); 
$suchregexp .= "|$s"; 
$suchliste = explode(" ",strtolower($suche)); 

$sql = "SELECT 
a.title AS title, a.idart AS idart, a.summary AS comment, a.idartlang AS idartlang, 
b.idcat AS idcat, 
c.parentid AS parentid, 
d.value AS content 
FROM 
".$cfg["tab"]["art_lang"]." AS a, 
".$cfg["tab"]["cat_art"]." AS b, 
".$cfg["tab"]["cat"]." AS c, 
".$cfg["tab"]["content"]." AS d 
WHERE 
a.idart = b.idart AND 
a.idartlang = d.idartlang AND 
b.idcat = c.idcat AND 
c.idclient = '$client' AND 
idlang = '$lang' AND 
online='1' AND 
(d.value REGEXP '$suchregexp' OR a.title REGEXP '$suchregexp' OR a.summary REGEXP '$suchregexp')"; 

$db->query($sql); 
if ($db->num_rows() != 0){ 
for ($i=0; $i<$db->num_rows(); $i++) { 
$db->next_record(); 
if ($auth->auth["uid"] == "nobody"){ 
$sql2 = "SELECT public FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".$db->f("idcat")."'"; 
$db2 = new DB_Contenido; $db2->query($sql2); $db2->next_record(); 
if($db2->f("public") == 0) continue; 
}; 
$num = 0 + $db->f("idartlang"); 
$results[$num][link] = "front_content.php?client=$client&lang=$lang&parent=".$db->f("parentid")."&idcat=".$db->f("idcat")."&idart=".$db->f("idart").""; 
$results[$num][title] = $db->f("title"); 
switch ("CMS_VALUE[2]") { 
case 0: $results[$num][text] = "";break; 
case 1: $results[$num][text] = $db->f("comment");break; 
case 2: $results[$num][text] .= substr(strip_tags(rawurldecode($db->f("content"))),0,100)."..."; 
}; 
for($x=0;$x<count($suchliste);$x++){ 
$hits[$num] += substr_count(strtolower($db->f("title")), $suchliste[$x]) + 
substr_count(strtolower($db->f("comment")), $suchliste[$x]) + 
substr_count(strtolower($db->f("content")), $suchliste[$x]); 
}; 
}; 
if(count($hits) > 0){ 
$hits = array_values($hits); 
$results = array_values($results); 
array_multisort ($results, SORT_DESC, SORT_NUMERIC, $hits, SORT_DESC, SORT_NUMERIC); 
for ($i=0; $i<count($hits); $i++){ 
echo "<tr><td align=left><font size=\"-1\"><a href=\"".$results[$i][link]."\" class='text'"; 
if("CMS_VALUE[3]"){echo "TARGET=\"CMS_VALUE[3]\" ";}; 
echo ">".$results[$i][title]."</a></font> <span class='text'>(".$hits[$i]." Treffer)<BR>"; 
echo $results[$i][text]."</span></td></tr>"; 
}; 
} else { echo "<tr><td class='text' align=center>Keine passenden Seiten gefunden</td></tr>"; }; 
} else { echo "<tr><td class='text' align=center>Keine passenden Seiten gefunden</td></tr>"; }; 
}; 
echo "</table>"; 
?>
Es lief ohne Probleme, aber ploetzlich habe ich solche Eintraege im Errorlog entdeckt:
[15-Apr-2004 12:47:10] PHP Warning: Cannot use a scalar value as an array in /PFAD_ZU/cms/front_content.php(563) : eval()'d code on line 620
[15-Apr-2004 12:47:10] PHP Warning: array_values(): The argument should be an array in /PFAD_ZU/cms/front_content.php(563) : eval()'d code on line 626
[15-Apr-2004 12:47:10] PHP Warning: array_multisort(): Argument #4 is expected to be an array or a sort flag in /PFAD_ZU/cms/front_content.php(563) : eval()'d code on line 628

Ausserdem habe ich festgestellt, dass die Suche auch gar nicht mehr funktioniert, weil eben diese Errorlog-Eintraege erzeugt werden. Wieso ist $hits ploetzlich kein Array mehr?

Was ich gemacht habe: ich habe vor laengerer Zeit von 4.4.2 auf 4.4.4 upgedatet, und vor nicht so langer Zeit habe ich noch die Datentypen von code in con_code und value in con_content von text auf longtext geaendert, und danach habe ich auch die con_code geleert (http://www.contenido.de/forum/viewtopic ... ext+update), weil wohl beim Update etwas schiefgelaufen war und die Aenderung nicht drin war. Ich vermute, dass die Volltextsuche nach der Datentyp-Aenderung 'kaputtgegangen' ist, aber sicher bin ich mir nicht.

'Sieht' jemand den Fehler? Ich habe die Volltextsuche erstmal deaktiviert, bevor mir die errorlog-Datei zugemuellt wird. :cry:

Gruss
Christa

Verfasst: Fr 16. Apr 2004, 22:17
von neu@cidnet.de
du schreibst das ja so:
<form name='suche' method='POST' action='front_content.php?idcat=100'>

ich musste feststellen, das die 4.4.4 sehr pingelig mit so dummen links ist.
ich habe das mal so bei mir ausprobiert (mit deiem geposteten Modul):

front_content.php?idcatart=40&lang=1&client=1

funtzt ohne irgendwelche probleme...
versuch einfach mal den link zu ändern
mit dem was du das hast, funtz bei mir auch nix :)


neu :D

Verfasst: Fr 16. Apr 2004, 22:48
von Halchteranerin
aehm, danke fuer den Tip, aber wie kriege ich die idcatart raus? Ich weiss nicht mal mehr, wie ich auf idcat=100 kam. :oops: Die habe ich wohl 'irgendwie' rausgekriegt ...

Gruss
Christa

Verfasst: Fr 16. Apr 2004, 22:57
von Halchteranerin
hab's zwar rausbekommen, es ist die Artikelnummer des Artikels mit der Volltextsuche, aber die Aenderung des Links hat leider nichts gebracht. Es kommen die gleichen Eintraege ins errorlog. :cry:

Verfasst: So 18. Apr 2004, 16:04
von Halchteranerin
Hat sonst niemand eine Idee, woher der Fehler 'ploetzlich' kommen koennte? Am Modul selbst habe ich nichts geaendert ...

Verfasst: Mo 19. Apr 2004, 14:50
von Beleuchtfix
Hallo Christa,
Halchteranerin hat geschrieben:Hat sonst niemand eine Idee, woher der Fehler 'ploetzlich' kommen koennte? Am Modul selbst habe ich nichts
geaendert ...
Ich benutze eine etwas ältere Suche,
Bietet eine Volltextsuche. Durchsucht Titel,Beschreibung und Content.
(c) webmaster@zu-hause.biz 16.09.2002
das ist die Überschrift. Ich weiß nicht mehr, wo genau sie her ist, aber hier aus der Modul Seite glaube ich
Hat das Upgrade auf 4.4.4 problemlos überstanden, gibt keine Fehlermeldungen.
Falls Du sie haben möchtest, kann ich sie dir schicken

Ich habe sie schon gefunden:
http://www.contenido.de/forum/viewtopic.php?t=2337

Gruß Florian

Verfasst: Mo 19. Apr 2004, 14:57
von Halchteranerin
Hi Florian,
Beleuchtfix hat geschrieben: Ich habe sie schon gefunden:
http://www.contenido.de/forum/viewtopic.php?t=2337
soweit ich das sehe, ist die aehnlich wie meine, nur dass meine zweigeteilt ist. Allerdings ist Snoopy dabei, eine Suche mit Highlighting zu implementieren, ich warte mal darauf, in der Hoffnung, dass sie bei mir auch funktioniert. So lange habe ich bei mir die Suche erstmal rausgenommen. :(

Gruss
Christa