Changeset 2618


Ignore:
Timestamp:
Jan 31, 2012, 2:19:54 PM (8 years ago)
Author:
goya
Message:

add facets to search api

Location:
cpc/trunk/project/apps/frontend/modules/solr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/solr/actions/actions.class.php

    r2514 r2618  
    107107    }
    108108
     109    $this->parlfacet = $request->getParameter('parlfacet', 0);
     110    $this->tagsfacet = $request->getParameter('tagsfacet', 0);
     111    $this->timefacet = $request->getParameter('timefacet', 0);
    109112    if ($format == 'json') {
    110113      $this->getResponse()->setContentType('text/plain; charset=utf-8');
     
    202205    }
    203206   
    204     if  (!$format && count($results['response']['docs']) == 1 && $results['response']['docs'][0]['object_name'] == 'Parlementaire') {
     207    if  (!$format && count($results['response']['docs']) == 1 && $results['response']['docs'][0]['object_name'] == 'Parlementaire' && !$request->getParameter('format')) {
    205208      return $this->redirect($results['response']['docs'][0]['object']->getLink());
    206209    }
  • cpc/trunk/project/apps/frontend/modules/solr/templates/jsonSuccess.php

    r1467 r2618  
    1 <?php if (!$tags) : ?>
     1<?php
     2if ($timefacet) {
     3        if (!isset($fdates))
     4                $exportfacet = null;
     5        else
     6                $exportfacet = $fdates;
     7}
     8if($parlfacet) {
     9        $exportfacet = null;
     10        if(isset($facet['parlementaires']))
     11                $exportfacet = $facet['parlementaires'];
     12}
     13if ($tagsfacet) {
     14        $exportfacet = null;
     15        if (isset($facet['tag']))
     16                $exportfacet = $facet['tag'];
     17}
     18if (isset($exportfacet)) {
     19        print(json_encode($exportfacet));
     20        return ;
     21}
     22
     23if (!$tags) : ?>
    224{ "start": <?php echo $results['start'] + 1; ?>, "end" : <?php echo $results['end'] - 1; ?>, "last_result" : <?php echo $results['numFound'];  ?>, "results" : {<?php
    325            $nb = 0;
Note: See TracChangeset for help on using the changeset viewer.