Overview

Namespaces

  • Apptus
    • ESales
      • Connector
        • Report
        • Time
    • Util
      • Cache
  • PHP

Classes

  • Ad
  • Ads
  • ArgMap
  • Attribute
  • AttributeValidation
  • Authorization
  • Category
  • CategoryData
  • CategoryList
  • CategoryNode
  • CloudConnector
  • ClusterUriIterator
  • Completion
  • Completions
  • CompressionMode
  • Connector
  • ConnectorSettingsBuilder
  • Correction
  • Corrections
  • Count
  • CssClass
  • CustomerKeyAuthentication
  • DynamicPage
  • EventDataJobResult
  • FacetList
  • FacetRange
  • Facets
  • Filter
  • FilterBuilder
  • ImportData
  • JavaScriptNotifier
  • MessageAuthentication
  • OnPremConnector
  • Order
  • OrderLine
  • Panel
  • PanelContent
  • Path
  • Phrase
  • Phrases
  • Product
  • Products
  • Reporter
  • ResultType
  • Session
  • Status
  • Subpanel
  • Value
  • Values
  • Variant

Interfaces

  • Facet
  • Result

Exceptions

  • BusyClusterException
  • ClusterUnavailableException
  • DuplicateSubpanelException
  • FetchClusterException
  • IOException
  • MalformedJsonException
  • MalformedURLException
  • MissingSubpanelException
  • PanelException
  • ParseException
  • ReportException
  • RequestFailedException
  • ResultTypeException
  • Overview
  • Namespace
  • Class
  • Tree

Class FilterBuilder

A set of static methods for building a filter.

The FilterBuilder class is a utility that is intended to be used to create filters for eSales queries. The methods in this class are all static and return some kind of Apptus\ESales\Connector\Filter limiting your search.

Example:

// Create some simple attribute filters
 $a = FilterBuilder::attribute('artist', 'Presley');
 $b = FilterBuilder::attribute('song', 'Jumpin\' Jack Flash');
 $c = FilterBuilder::attribute('description', 'Rock nostalgia');

 echo 'Created some attribute filters:' . PHP_EOL;
 echo $a . PHP_EOL;
 echo $b . PHP_EOL;
 echo $c . PHP_EOL;

 echo PHP_EOL;

 // Let's combine them
 $kingOfRock = FilterBuilder::andFilter($a, $c);
 echo $kingOfRock . PHP_EOL;
 $classic = FilterBuilder::andFilter(b, c);
 echo $classic . PHP_EOL;
 $justCool = FilterBuilder::orFilter(a, b);
 echo $justCool . PHP_EOL;
 $coolOldie = FilterBuilder::andFilter(justCool, c);
 echo $coolOldie . PHP_EOL;

 echo PHP_EOL;

 // Let's add some more stuff into the mix
 $lamers = FilterBuilder::attributeFilter('artist', 'Sofarock');
 $lamers = FilterBuilder::orFilter($lamers, FilterBuilder::attributeFilter('artist', 'amazonics'));
 $noLamers = FilterBuilder::notFilter($lamers);
 echo $noLamers . PHP_EOL;

 // Combine more than 2 filters at once by simply supplying them all
 $theOriginal = FilterBuilder::andFilter($classic, $noLamers, $c);
 echo $theOriginal . PHP_EOL;
Namespace: Apptus\ESales\Connector
Located at Connector/FilterBuilder.php
Methods summary
public static Apptus\ESales\Connector\Filter
# notFilter( Apptus\ESales\Connector\Filter $operand )

Create a new NOT filter matching every result that the given operand doesn't match.

Create a new NOT filter matching every result that the given operand doesn't match.

Parameters

$operand
operand to negate.

Returns

Apptus\ESales\Connector\Filter
A NOT filter
public static Apptus\ESales\Connector\Filter
# andFilter( )

Create a new AND filter to match the intersection of the results that all the given filters would return.

Create a new AND filter to match the intersection of the results that all the given filters would return.

Returns

Apptus\ESales\Connector\Filter
An AND filter
public static Apptus\ESales\Connector\Filter
# orFilter( )

Create a new OR filter to match the union of the results that all the given filters would return.

Create a new OR filter to match the union of the results that all the given filters would return.

Returns

Apptus\ESales\Connector\Filter
An OR filter.
public static Apptus\ESales\Connector\Filter
# attributeFilter( string|array $attributes, string $value )

Create a new attribute filter, limiting results to products where all processed parts (after tokenization and normalization) of the specified

$value

are present within any of the given

$attributes

.

Create a new attribute filter, limiting results to products where all processed parts (after tokenization and normalization) of the specified

$value

are present within any of the given

$attributes

.

Parameters

$attributes
single attribute or an array of attributes to search within.
$value
value to match.

Returns

Apptus\ESales\Connector\Filter
An attribute filter.
public static Apptus\ESales\Connector\Filter
# fromString( string $filter, boolean $needsParentheses = true )

Create a new filter from a string representation of a filter.

Create a new filter from a string representation of a filter.

Parameters

$filter
string representation of the filter to match.
$needsParentheses
if parentheses is needed when this filter is part of a composite filter.

Returns

Apptus\ESales\Connector\Filter
A string filter.
public static Apptus\ESales\Connector\Filter
# incrementalFilter( string|array $attributes, string $value )

Create a new INCREMENTAL filter, limiting the result to products where all processed parts (after tokenization and normalization) of the specified

$value

are present within any of the given

$attributes

. The last value token matches if any attribute contains a value to which it is a prefix (after tokenization).

Create a new INCREMENTAL filter, limiting the result to products where all processed parts (after tokenization and normalization) of the specified

$value

are present within any of the given

$attributes

. The last value token matches if any attribute contains a value to which it is a prefix (after tokenization).

Parameters

$attributes
single attribute or a list of attributes to search within.
$value
value to match.

Returns

Apptus\ESales\Connector\Filter
An incremental filter.
public static Apptus\ESales\Connector\Filter
# rangeFilter( string|array $attributes, string $from, string $to, boolean $fromInc = true, boolean $toInc = false )

Create a new range filter limiting results to values between

$from

and

$to

, for any of the specified

$attributes

. Whether or not the bounds should be considered inclusive or exclusive is determined by the specified

$fromInc

and

$toInc

parameters.

Create a new range filter limiting results to values between

$from

and

$to

, for any of the specified

$attributes

. Whether or not the bounds should be considered inclusive or exclusive is determined by the specified

$fromInc

and

$toInc

parameters.

Parameters

$attributes
single attribute or a list of attributes.
$from
lower bound.
$to
upper bound.
$fromInc
the lower bound is to be considered inclusive.
$toInc
the upper bound is to be considered inclusive.

Returns

Apptus\ESales\Connector\Filter
A range filter as described above.
public static Apptus\ESales\Connector\Filter
# universeFilter( )

Return a universe filter representing all results.

Return a universe filter representing all results.

Returns

Apptus\ESales\Connector\Filter
The universe filter.
public static Apptus\ESales\Connector\Filter
# emptyFilter( )

Return a empty filter representing no results.

Return a empty filter representing no results.

Returns

Apptus\ESales\Connector\Filter
The empty filter.
Apptus ESales Connector PHP API documentation generated by ApiGen