Changeset 82470 in spip-zone


Ignore:
Timestamp:
May 16, 2014, 8:57:29 PM (5 years ago)
Author:
fil@…
Message:

pas de raison d'interdire les recherches sans query fulltext

Location:
_plugins_/indexer/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/indexer/trunk/content/sphinx.html

    r82468 r82470  
    2929]</BOUCLE_filtres>
    3030
    31 <BOUCLE_recherche(DATA) {source SphinxQL, #GET{sql}} {si #ENV{recherche}}>
     31<BOUCLE_recherche(DATA) {source SphinxQL, #GET{sql}}>
    3232
    3333    <B_documents>
  • _plugins_/indexer/trunk/inclure/liste_sphinx_facette.html

    r82469 r82470  
    88        #GET{order}})]})]
    99
    10 <BOUCLE_resultats(DATA) {source SphinxQL, #GET{sqlf}} {si #ENV{recherche}}>
     10<BOUCLE_resultats(DATA) {source SphinxQL, #GET{sqlf}}>
    1111    <B_facette>
    1212        <h2>#ENV{titre}</h2>
  • _plugins_/indexer/trunk/indexer_fonctions.php

    r82466 r82470  
    2020        ->select("SNIPPET(content, " . $sq->quote($recherche . ($tag ? " $tag" : '')) . ", 'limit=200') AS snippet")
    2121        ->from($index)
    22         ->where("MATCH(" . $sq->quote($recherche) . ")")
     22        ->where(strlen($recherche) ? "MATCH(" . $sq->quote($recherche) . ")" : null)
    2323        ->facet("properties.authors ORDER BY COUNT(*) DESC")
    2424        ->facet("properties.tags ORDER BY COUNT(*) DESC")
  • _plugins_/indexer/trunk/lib/Sphinx/SphinxQLQuery.php

    r82466 r82470  
    270270        if ($this->select)   $query[] = 'SELECT '   . implode(',', $this->select);
    271271        if ($this->from)     $query[] = 'FROM '     . implode(',', $this->from);
    272         if ($this->where)    $query[] = 'WHERE ('   . implode(') AND (', $this->where) . ')';
     272        if ($this->where = array_filter($this->where))    $query[] = 'WHERE ('   . implode(') AND (', $this->where) . ')';
    273273        if ($this->groupby)  $query[] = 'GROUP BY ' . implode(',', $this->groupby);
    274274        if ($this->orderby)  $query[] = 'ORDER BY ' . implode(',', $this->orderby);
Note: See TracChangeset for help on using the changeset viewer.