SearchVariantSubsites
class SearchVariantSubsites extends SearchVariant (View source)
Properties
protected static | $variants | Holds a cache of all variants |
from SearchVariant | |
protected static | $class_variants | Holds a cache of the variants keyed by "class!" "1"? (1 = include subclasses) |
from SearchVariant | |
protected static | $call_instances | Holds a cache of SearchVariant_Caller instances, one for each class/includeSubclasses setting |
from SearchVariant |
Methods
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
Return true if this variant applies to the passed class & subclass
This field has been altered to allow a user to obtain search results for a particular subsite When attempting to do this in project code, SearchVariantSubsites kicks and overwrites any filter you've applied This fix prevents the module from doing this if a filter is applied on the index or the query, or if a field is being excluded specifically before being executed.
Returns an array of variants.
Lets you call any function on all variants that support it, in the same manner as "Object#extend" calls a method from extensions.
A shortcut to with when calling without passing in a class,
Get the current state of every variant
Activate all the states in the passed argument
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
Add new filter field to index safely.
Merge sets of (or individual) class names together for a search index field.
We need really complicated logic to find just the changed subsites (because we use versions there's no explicit deletes, just new versions with different members) so just always use all of them
Determine if a field with a certain name is filtered by the search query or on the index This is the equivalent of saying "show me the results that do ONLY contain this value"
Details
__construct()
No description
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
appliesTo($class, $includeSubclasses)
Return true if this variant applies to the passed class & subclass
currentState()
Return the current state
reindexStates()
Return all states to step through to reindex all items
activateState($state)
Activate the passed state
alterQuery(SearchQuery $query, SearchIndex $index)
This field has been altered to allow a user to obtain search results for a particular subsite When attempting to do this in project code, SearchVariantSubsites kicks and overwrites any filter you've applied This fix prevents the module from doing this if a filter is applied on the index or the query, or if a field is being excluded specifically before being executed.
A pull request has been raised for this issue. Once accepted this forked module can be deleted and the parent project should be used instead.
static array
variants(string $class = null, bool $includeSubclasses = true)
Returns an array of variants.
With no arguments, returns all variants
With a classname as the first argument, returns the variants that apply to that class (optionally including subclasses)
static SearchVariant_Caller
with(string $class = null, bool $includeSubclasses = true)
Lets you call any function on all variants that support it, in the same manner as "Object#extend" calls a method from extensions.
Usage: SearchVariant::with(...)->call($method, $arg1, ...);
static
call($method, $a1 = null, $a2 = null, $a3 = null, $a4 = null, $a5 = null, $a6 = null, $a7 = null)
A shortcut to with when calling without passing in a class,
SearchVariant::call(...) ==== SearchVariant::with()->call(...);
static array
current_state($class = null, $includeSubclasses = true)
Get the current state of every variant
static void
activate_state($state)
Activate all the states in the passed argument
static SearchVariant_ReindexStateIteratorRet
reindex_states(string $class = null, bool $includeSubclasses = true)
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
protected
addFilterField(SearchIndex $index, string $name, array $field)
Add new filter field to index safely.
This method will respect existing filters with the same field name that correspond to multiple classes
protected array|string
mergeClasses(array|string $left, array|string $right)
Merge sets of (or individual) class names together for a search index field.
If there is only one unique class name, then just return it as a string instead of array.
alterDefinition($class, $index)
No description
extractManipulationWriteState($writes)
We need really complicated logic to find just the changed subsites (because we use versions there's no explicit deletes, just new versions with different members) so just always use all of them
protected bool
isFieldFiltered($field, $query)
Determine if a field with a certain name is filtered by the search query or on the index This is the equivalent of saying "show me the results that do ONLY contain this value"