Changeset 82434 in spip-zone


Ignore:
Timestamp:
May 16, 2014, 7:48:15 AM (5 years ago)
Author:
fil@…
Message:

signer les donnees

Location:
_plugins_/indexer/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/indexer/trunk/Sources/SpipSourcesIndexer.php

    r82426 r82434  
    221221            $stats['last']['time']['indexing'] += $t;
    222222            $stats['sources'][$skey]['time']['indexing'] += $t;
    223             echo "<br />Indexage: " . $this->getNiceTime($t) . "\n";
     223            echo "<br />Enregistrement dans l'index: " . $this->getNiceTime($t) . "\n";
    224224        }
    225225    }
  • _plugins_/indexer/trunk/lib/Indexer/Storage/Sphinx.php

    r82369 r82434  
    2424        $query = "
    2525            REPLACE INTO $this->indexName
    26                 (id,  title, summary, content, date, uri, properties)
     26                (id,  title, summary, content, date, uri, properties, signature)
    2727            VALUES
    28                 (:id, :title, :summary, :content, :date, :uri, :properties)
     28                (:id, :title, :summary, :content, :date, :uri, :properties, :signature)
    2929        ";
    3030        $prepare = $this->sphinxql->prepare($query);
     
    5050           "date" => strtotime($document->date),
    5151           "uri" => $document->uri,
    52            "properties" => json_encode($document->properties)
     52           "properties" => json_encode($document->properties),
     53            "signature" => $this->signer($document),
    5354        ];
    5455    }
    5556
     57    public function signer($doc) {
     58        include_spip('inc/securiser_action');
     59        return md5(secret_du_site().json_encode($doc));
     60    }
    5661
    5762}
  • _plugins_/indexer/trunk/prive/squelettes/contenu/sphinx.html

    r82423 r82434  
    6161</aside>
    6262
    63 [(#ENV{tag}|?{[(#SET{tag,[IN(properties.tags,(#ENV{tag}|_q)) AS tag]})]})]
     63[(#ENV{tag}|?{[(#SET{tag,[IN(properties.tags,(#ENV*{tag}|_q)) AS tag]})]})]
    6464[(#ENV{tag}|=={'-'}?{[(#SET{tag,"LENGTH(properties.tags)=0 AS tag"})]})]
    6565
    6666[(#SET{sql,"SELECT WEIGHT() AS score, *, SNIPPET(content,"[(#ENV*{recherche}|concat{' '}|concat{#ENV{tag}}|_q|concat{","})]'limit=200') as snippet [, (#GET{tag})] FROM [(#ENV{source,spip})] WHERE MATCH([(#ENV*{recherche}|_q)])[ (#GET{tag}|?{AND tag=1})][ ORDER BY (#GET{order})] LIMIT 10})]
    6767
     68[(#SET{sql2,[(#GET{sql}|concat{"  FACET properties.tags ORDER BY COUNT(*) DESC"})]})]
    6869
    69 
    70 <pre>[(#GET{sql}|htmlspecialchars)]</pre>
     70<pre>[(#GET{sql2}|htmlspecialchars)]</pre>
    7171
    7272
    7373<BOUCLE_recherche(DATA) {source SphinxQL, #GET{sql}} {si #ENV{recherche}}>
     74
     75<h2>clé: #CLE</h2>
     76
     77
    7478        <B_documents>
    7579            <h2>Liste des documents trouvés</h2>
     
    122126#SET{lat,1.283}
    123127
     128[(#REM) Bordeaux]
     129#SET{lon,-0.567}
     130#SET{lat,44.833}
     131
    124132[(#SET{grouper,#VAL{'INTERVAL(GEODIST('}|concat{#GET{lat}}|concat{','}|concat{#GET{lon}}|concat{',UINT(properties.geo.lat),UINT(properties.geo.lon)),100,300,1000,3000,10000,30000,100000,300000,1000000,3000000,10000000)'}})]
    125133[(#SET{sqlf,"SELECT COUNT(*) AS c, "[(#GET{grouper}) AS grouper, ]GROUPBY() AS facette FROM [(#ENV{source,spip})] WHERE MATCH([(#ENV*{recherche}|_q)]) GROUP BY grouper ORDER BY grouper ASC LIMIT 30})]
     
    129137[(#REM)
    130138
    131         Facette par JSON multivalué
     139        Facette par JSON multivalué (tag)
    132140
    133141]
    134142[(#SET{sqlf,"SELECT COUNT(*) AS c, "GROUPBY() AS facette FROM [(#ENV{source,spip})] WHERE MATCH([(#ENV*{recherche}|_q)]) GROUP BY properties.tags ORDER BY c DESC LIMIT 30})]
     143
     144
     145
     146[(#REM)
     147
     148        Facette par JSON multivalué (auteur)
     149
     150]
     151[(#SET{xxxsqlf,"SELECT COUNT(*) AS c, "GROUPBY() AS facette FROM [(#ENV{source,spip})] WHERE MATCH([(#ENV*{recherche}|_q)]) GROUP BY properties.authors ORDER BY c DESC LIMIT 30})]
     152
    135153
    136154<pre>[(#GET{sqlf}|htmlspecialchars)]</pre>
     
    138156
    139157<BOUCLE_facettes(DATA) {source SphinxQL, #GET{sqlf}} {si #ENV{recherche}}>
     158
    140159        <B_facette>
    141160            <h2>Liste des facettes</h2>
Note: See TracChangeset for help on using the changeset viewer.