Example #1
0
 public function testSetFeedFilter()
 {
     $search = new AfsSearch('127.0.0.1', 666);
     $query = new AfsQuery();
     $query = $query->set_filter_on_feed('foo', array('bar'), 'feed');
     $search->set_query($query);
     $search->execute();
     $this->assertTrue(strpos($search->get_generated_url(), 'filter%40feed=foo%3Dbar') !== False, 'URL does not contain query!');
 }
Example #2
0
<?php

/** @file raw_example.php
 * @example raw_example.php
 */
require_once "PHP_API/afs_lib.php";
$search = new AfsSearch('eval.partners.antidot.net', 48000);
$query = $search->build_query_from_url_parameters();
$query = $query->set_lang('fr');
// language is set manually in order to get spellcheck results
$query = $query->set_multi_selection_facets('classification');
$query = $query->set_mono_selection_facets('afs:lang', 'has_variants', 'has_image');
$query = $query->set_facet_order('price_eur', 'marketing', 'classification', 'has_variants', 'has_image');
$query = $query->set_facets_values_sort_order(AfsFacetValuesSortMode::ITEMS, AfsSortOrder::DESC);
$helper = $search->execute($query);
$generated_url = $search->get_generated_url();
$clustering_is_active = $query->has_cluster();
$nsmap = array('ns' => 'http://ref.antidot.net/store/afs#');
?>


<html>
<head>
    <title>Antidot PHP API - Raw example</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="../../assets/js/html5shiv.js"></script>