function analyse_query($input, $debut = 0, $parenthesis = 0, $search_linked_words = 1, $keep_empty = 0) { // remplacement espace insécable 0xA0: global $empty_word; $input = clean_nbsp($input); $this->parenthesis = $parenthesis; $this->current_car = $debut; $this->input = $input; $this->keep_empty = $keep_empty; $this->search_linked_words = $search_linked_words; $this->recurse_analyse(); // pour remonter les termes exacts, mais ne marche pas pour les autorités. A revoir if (!$parenthesis) { if (!$this->keep_empty && in_array($this->input, $empty_word) === false || $this->keep_empty) { $t = new term(trim($this->input, "_~\""), 2, 0, 1, "or", null, 0.2); $this->store_in_tree($t, 0); } } }
function strip_empty_words($string, $lg = 0) { // on inclut le tableau des mots-vides pour la langue par defaut si elle n'est pas precisee // c'est normalement la langue de catalogage... // sinon on inclut le tableau des mots vides pour la langue precisee // si apres nettoyage des mots vide la chaine est vide alors on garde la chaine telle quelle (sans les accents) global $pmb_indexation_lang; // global $lang; global $include_path; if (!$lg || $lg == $pmb_indexation_lang) { global $empty_word; } else { include "{$include_path}/marc_tables/{$lg}/empty_words"; } //echo "<pre>"; //print_r($empty_word); //echo "</pre>"; // nettoyage de l'entree // traitement des diacritiques $string = convert_diacrit($string); // Mis en commentaire : qu'en est-il des caracteres non latins ??? // SUPPRIME DU COMMENTAIRE : ER : 12/05/2004 : ça fait tout merder... // RECH_14 : Attention : ici suppression des eventuels " // les " ne sont plus supprimes $string = stripslashes($string); $string = pmb_alphabetic('^a-z0-9\\s', ' ', pmb_strtolower($string)); // remplacement espace insécable 0xA0: Non-breaking space $string = clean_nbsp($string); // espaces en debut et fin $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string); // espaces en double $string = pmb_preg_replace('/\\s+/', ' ', $string); $string_avant_mots_vides = $string; // suppression des mots vides if (is_array($empty_word)) { foreach ($empty_word as $dummykey => $word) { $word = convert_diacrit($word); $string = pmb_preg_replace("/^{$word}\$|^{$word}\\s|\\s{$word}\\s|\\s{$word}\$/i", ' ', $string); // RECH_14 : suppression des mots vides colles à des guillemets if (pmb_preg_match("/\"{$word}\\s/i", $string)) { $string = pmb_preg_replace("/\"{$word}\\s/i", '"', $string); } if (pmb_preg_match("/\\s{$word}\"/i", $string)) { $string = pmb_preg_replace("/\\s{$word}\"/i", '"', $string); } } } // re nettoyage des espaces generes // espaces en debut et fin $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string); // espaces en double $string = pmb_preg_replace('/\\s+/', ' ', $string); if (!$string) { $string = $string_avant_mots_vides; // re nettoyage des espaces generes // espaces en debut et fin $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string); // espaces en double $string = pmb_preg_replace('/\\s+/', ' ', $string); } return $string; }
function analyse_query($input, $debut = 0, $parenthesis = 0, $search_linked_words = 1, $keep_empty = 0, $stemming = false) { // remplacement espace insécable 0xA0: global $empty_word; global $opac_default_operator; global $opac_allow_term_troncat_search; global $opac_exclude_fields; global $opac_search_relevant_with_frequency; $this->default_operator = $opac_default_operator; $this->allow_term_troncat_search = $opac_allow_term_troncat_search; $this->exclude_fields = $opac_exclude_fields; $this->search_relevant_with_frequency = $opac_search_relevant_with_frequency; $input = clean_nbsp($input); $this->parenthesis = $parenthesis; $this->current_car = $debut; $this->input = $input; $this->keep_empty = $keep_empty; $this->stemming = $stemming; $this->search_linked_words = $search_linked_words; $this->recurse_analyse(); if ($this->parenthesis == 0) { $this->tree = $this->nettoyage_etoile($this->tree, false); } if ($this->stemming) { $this->add_stemming(); } // pour remonter les termes exacts, mais ne marche pas pour les autorités. A revoir if (!$parenthesis && !$this->tree[0]->not) { if (!$this->keep_empty && in_array($this->input, $empty_word) === false || $this->keep_empty) { $t = new term(trim($this->input, "_~\""), 2, 0, 1, "or", null, 0.2); $this->store_in_tree($t, 0); } } }