[SearchEngine] Update query parser

This commit is contained in:
Romain Neutron
2012-10-16 19:06:00 +02:00
parent c1d952a17e
commit bd36dc4a0c

View File

@@ -777,70 +777,11 @@ class PhraseaEngineQueryParser
$this->proposals["BASES"]["b$bid"]["TERMS"][$path]["HTML"] = $prophtml;
} else {
// le mot n'est pas dans le thesaurus
$tree = null;
}
return($ambigus);
}
/*
function dead_setTids(&$tree, &$simple, $bid, &$domthe, $searchsynonyms)
{
// if($this->debug)
print("setTids:\n\$tree=" . var_export($tree, true) . "\n");
$ambigus = 0;
if(is_array($w = $simple["VALUE"]))
$t = $w = implode(" ", $w);
if (isset($tree["CONTEXT"])) {
if (!$tree["CONTEXT"]) {
$x0 = "@w=\"" . $w ."\" and not(@k)";
} else {
if ($tree["CONTEXT"]=="*") {
$x0 = "@w=\"" . $w ."\"";
} else {
$x0 = "@w=\"" . $w ."\" and @k=\"" . $tree["CONTEXT"] . "\"";
$t .= " (" . $tree["CONTEXT"] . ")";
}
}
} else {
$x0 = "@w=\"" . $w ."\"";
}
$x = "/thesaurus//sy[" . $x0 ."]";
if($this->debug)
printf("searching thesaurus with xpath='%s'<br/>\n", $x);
$dxp = new DOMXPath($domthe);
$nodes = $dxp->query($x);
if(!isset($tree["RB"]["SREF"]["TIDS"]))
$tree["RB"]["SREF"]["TIDS"] = array();
if ($nodes->length >= 1) {
if ($nodes->length == 1) {
// on cherche un id simple, on utilisera la syntaxe sql 'like' (l'extension repérera elle méme la syntaxe car la value finira par '%')
$this->addtoTIDS($tree["RB"], $bid, $nodes->item(0));
// $this->thesaurusDOMNodes[] = $nodes->item(0);
} else {
// on cherche plusieurs id's, on utilisera la syntaxe 'regexp' (l'extension repérera elle meme la syntaxe car la value finira par '$')
$val = "";
foreach ($nodes as $node) {
if(!isset($tree["CONTEXT"]))
$ambigus++;
$this->addtoTIDS($tree["RB"], $bid, $node);
}
}
$path = $tree["RB"]["SREF"]["PATH"];
$prophtml = "";
$this->propAsHTML($domthe->documentElement, $prophtml, $path);
$this->proposals["TERMS"][$path]["HTML"] = $prophtml;
} else {
// le mot n'est pas dans le thesaurus
}
return($ambigus);
}
*/
public function containsColonOperator(&$tree)
{
@@ -1735,7 +1676,7 @@ class PhraseaEngineQueryParser
if ($nok < $this->app['phraseanet.registry']->get('GV_min_letters_truncation')) {
if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n");
$this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "<br>" . $registry->get('GV_min_letters_truncation');
$this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "<br>" . $this->app['phraseanet.registry']->get('GV_min_letters_truncation');
return(null);
}