SilverStripe\FullTextSearch\Search\Variants\SearchVariant
A Search Variant handles decorators and other situations where the items to reindex or search through are modified from the default state - for instance, dealing with Versioned or Subsite
Synopsis
class SearchVariant
{
- // members
- private static boolean $enabled = true;
- protected static $variants = NULL;
- protected static array $class_variants = ;
- protected static array $call_instances = ;
- // methods
- public void __construct()
- public void appliesToEnvironment()
- public abstract void appliesTo()
- public abstract void currentState()
- public abstract void reindexStates()
- public abstract void activateState()
- public abstract void alterQuery()
- public static array variants()
- public static void clear_variant_cache()
- public static SearchVariant_Caller with()
- public static SearchVariant_Caller withCommon()
- public static void call()
- public static array current_state()
- public static void activate_state()
- public static SearchVariant_ReindexStateIteratorRet reindex_states()
- protected void addFilterField()
- protected array|string mergeClasses()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Members
private
- $enabled
—
boolean
Whether this variant is enabled
protected
-
$call_instances
Holds a cache of SearchVariant_Caller instances, one for each class/includeSubclasses setting -
$class_variants
Holds a cache of the variants keyed by "class!" "1"? (1 = include subclasses) -
$variants
Holds a cache of all variants
Methods
protected
- addFilterField() — Add new filter field to index safely.
- mergeClasses() — Merge sets of (or individual) class names together for a search index field.
public
- __construct()
- activateState() — Activate the passed state
- activate_state() — Activate all the states in the passed argument
- alterQuery() — Apply this variant to a search query
- appliesTo() — Return true if this variant applies to the passed class & subclass
- appliesToEnvironment() — Return false if there is something missing from the environment (probably a not installed module) that means this variant can't apply to any class
- call() — A shortcut to with when calling without passing in a class,
- clear_variant_cache() — Clear the cached variants
- currentState() — Return the current state
- current_state() — Get the current state of every variant
- reindexStates() — Return all states to step through to reindex all items
- reindex_states() — Return an iterator that, when used in a for loop, activates one combination of reindex states per loop, and restores back to the original state at the end
- variants() — Returns an array of variants.
- with() — Lets you call any function on all variants that support it, in the same manner as "Object#extend" calls a method from extensions.
- withCommon() — Similar to {@link SearchVariant::with}, except will only use variants that apply to at least one of the classes in the input array, where {@link SearchVariant::with} will run the query on the specific class you give it.