SearchQuery
        
        extends BaseQuery
    
    
            
            in package
            
        
    
    
    
Class SearchQuery Cover any changes between the SilverStripe FulltextSearch module and the upgraded module
Table of Contents
Properties
- $default_page_size : int
 - $andFacetFilter : array<string|int, mixed>
 - Key => value pairs of facets to apply in AND fashion [ 'FacetTitle' => [1, 2, 3], 'FacetTitle2' => [1, 2, 3] ]
 - $boostedFields : array<string|int, mixed>
 - Sets boosting at _index_ time or _query_ time. Depending on the usage of this trait [ 'FieldName' => 2, ]
 - $class : array<string|int, mixed>
 - $exclude : array<string|int, mixed>
 - $facetFields : array<string|int, mixed>
 - Format: SiteTree::class => [ 'BaseClass' => SiteTree::class, 'Field' => 'ChannelID', 'Title' => 'Channel' ], Object::class => [ 'BaseClass' => Object::class, 'Field' => 'Relation.ID', 'Title' => 'Relation' ],
 - $facetsMinCount : int
 - $fields : array<string|int, mixed>
 - $filter : array<string|int, mixed>
 - $followSpellcheck : bool
 - $highlight : array<string|int, mixed>
 - $orFacetFilter : array<string|int, mixed>
 - Key => value pairs of facets to apply in OR fashion [ 'FacetTitle' => [1, 2, 3], 'FacetTitle2' => [1, 2, 3] ]
 - $rows : int
 - $sort : array<string|int, mixed>
 - $spellcheck : bool
 - $start : int
 - $terms : array<string|int, mixed>
 
Methods
- addAndFacetFilter() : $this
 - Stub for addFacetFilter to add an AND filter
 - addBoostedField() : $this
 - Add a boosted field to be boosted at query time
 - addClass() : $this
 - Add a class to index or query $options is not used anymore, added for backward compatibility
 - addExclude() : $this
 - Exclude fields from the search action
 - addFacetFilter() : $this
 - Add faceting fields that need to be faceted in an AND format
 - addField() : $this
 - Add a field to be returned
 - addFilter() : $this
 - Adds filters to filter on by value
 - addHighlight() : $this
 - Add a highlight parameter
 - addOrFacetFilter() : $this
 - Add faceting that need to be faceted in an OR formats
 - addSearchTerm() : $this
 - A simple stub to cover changes between Solr Search modules
 - addSort() : $this
 - Add a field to sort on
 - addTerm() : $this
 - Each boosted query needs a separate addition! e.g. $this->addTerm('test', ['MyField', 'MyOtherField'], 3) followed by $this->addTerm('otherTest', ['Title'], 5);
 - getAndFacetFilter() : array<string|int, mixed>
 - Stub for AND facets to be get
 - getBoostedFields() : array<string|int, mixed>
 - Get the boosted fields
 - getClasses() : array<string|int, mixed>
 - Get classes
 - getExclude() : array<string|int, mixed>
 - Get the excludes
 - getFacetFields() : array<string|int, mixed>
 - Get the facet fields
 - getFacetFilter() : array<string|int, mixed>
 - Get the AND facet filtering
 - getFacetsMinCount() : int
 - Get the facet count minimum to use
 - getFields() : array<string|int, mixed>
 - Get the fields to return
 - getFilter() : array<string|int, mixed>
 - Get the filters
 - getHighlight() : array<string|int, mixed>
 - Get the highlight parameters
 - getLimit() : int
 - Get the rows that are to be returned Compatibility stub
 - getOrFacetFilter() : array<string|int, mixed>
 - Get the OR based facet filtering
 - getRows() : int
 - Get the rows to return
 - getSort() : array<string|int, mixed>
 - Get the sort fields
 - getStart() : int
 - Get the offset to start
 - getTerms() : array<string|int, mixed>
 - Get the search terms
 - hasSpellcheck() : bool
 - Do we have spellchecking
 - setAndFacetFilter() : BaseQuery
 - Stub for AND facets to be set
 - setBoostedFields() : $this
 - Boosted fields are used at index time, not at query time
 - setClasses() : $this
 - Set the classes
 - setExclude() : $this
 - Set the query excludes
 - setFacetFields() : $this
 - Set the facet fields
 - setFacetFilter() : BaseQuery
 - Set the AND based facet filtering
 - setFacetsMinCount() : $this
 - Set the minimum count of facets to be returned
 - setFields() : $this
 - Set fields to be returned
 - setFilter() : $this
 - Set the query filters
 - setFollowSpellcheck() : BaseQuery
 - Set if we should follow spellchecking
 - setHighlight() : $this
 - Set the highlight parameters
 - setLimit() : $this
 - Set the rows that are to be returned Compatibility stub
 - setOrFacetFilter() : BaseQuery
 - Set the OR based facet filtering
 - setRows() : $this
 - Set the rows to return
 - setSort() : $this
 - Set the sort fields
 - setSpellcheck() : self
 - Set the spellchecking on this query
 - setStart() : $this
 - Set the offset to start
 - setTerms() : $this
 - Set the search tearms
 - shouldFollowSpellcheck() : bool
 - Should spellcheck suggestions be followed
 
Properties
$default_page_size
    public
    static    int
    $default_page_size
     = 10
    
        Default page size
$andFacetFilter
Key => value pairs of facets to apply in AND fashion [ 'FacetTitle' => [1, 2, 3], 'FacetTitle2' => [1, 2, 3] ]
    protected
        array<string|int, mixed>
    $andFacetFilter
     = []
    
    
    
$boostedFields
Sets boosting at _index_ time or _query_ time. Depending on the usage of this trait [ 'FieldName' => 2, ]
    protected
        array<string|int, mixed>
    $boostedFields
     = []
    
    
    
$class
    protected
        array<string|int, mixed>
    $class
     = []
    
        Classes to use
$exclude
    protected
        array<string|int, mixed>
    $exclude
     = []
    
        Fields to exclude
$facetFields
Format: SiteTree::class => [ 'BaseClass' => SiteTree::class, 'Field' => 'ChannelID', 'Title' => 'Channel' ], Object::class => [ 'BaseClass' => Object::class, 'Field' => 'Relation.ID', 'Title' => 'Relation' ],
    protected
        array<string|int, mixed>
    $facetFields
     = []
        The facets will be applied as a single "AND" query. e.g. SiteTree_ChannelID:1 with Object_Relation_ID:5 will not be found, if the facet filter requires the SiteTree_ChannelID to be 1 AND Object_Relation_ID to be 3 or 6
$facetsMinCount
    protected
        int
    $facetsMinCount
     = 1
    
        Minimum results a facet query has to have
$fields
    protected
        array<string|int, mixed>
    $fields
     = []
    
        Fields to search
$filter
    protected
        array<string|int, mixed>
    $filter
     = []
    
        Fields to filter
$followSpellcheck
    protected
        bool
    $followSpellcheck
     = false
    
        Follow spellchecking if there are no results
$highlight
    protected
        array<string|int, mixed>
    $highlight
     = []
    
        Highlighted items
$orFacetFilter
Key => value pairs of facets to apply in OR fashion [ 'FacetTitle' => [1, 2, 3], 'FacetTitle2' => [1, 2, 3] ]
    protected
        array<string|int, mixed>
    $orFacetFilter
     = []
    
    
    
$rows
    protected
        int
    $rows
     = 10
    
        Total rows to display
$sort
    protected
        array<string|int, mixed>
    $sort
     = []
    
        Sorting order
$spellcheck
    protected
        bool
    $spellcheck
     = true
    
        Enable spellchecking?
$start
    protected
        int
    $start
     = 0
    
        Pagination start
$terms
    protected
        array<string|int, mixed>
    $terms
     = []
    
        Terms to search
Methods
addAndFacetFilter()
Stub for addFacetFilter to add an AND filter
    public
                    addAndFacetFilter(string $field, string|array<string|int, mixed> $value) : $this
    Parameters
- $field : string
 - $value : string|array<string|int, mixed>
 
Return values
$thisaddBoostedField()
Add a boosted field to be boosted at query time
    public
                    addBoostedField(string $field[, array<string|int, mixed>|int $options = [] ][, int|null $boost = null ]) : $this
    This method is out of place in a way, but it's a shared method between Index and Query, thus needs to be here.
Parameters
- $field : string
 - $options : array<string|int, mixed>|int = []
 - $boost : int|null = null
 
Return values
$thisaddClass()
Add a class to index or query $options is not used anymore, added for backward compatibility
    public
                    addClass( $class[, array<string|int, mixed> $options = [] ]) : $this
    Parameters
Return values
$thisaddExclude()
Exclude fields from the search action
    public
                    addExclude(string $field, string|array<string|int, mixed>|Criteria $value) : $this
    Parameters
- $field : string
 - $value : string|array<string|int, mixed>|Criteria
 
Return values
$thisaddFacetFilter()
Add faceting fields that need to be faceted in an AND format
    public
                    addFacetFilter(string $field, string|array<string|int, mixed> $value) : $this
    Parameters
- $field : string
 - 
                    
Field to facet
 - $value : string|array<string|int, mixed>
 - 
                    
Value to facet
 
Return values
$thisaddField()
Add a field to be returned
    public
                    addField(string $field) : $this
    Parameters
- $field : string
 - 
                    
fieldname
 
Return values
$thisaddFilter()
Adds filters to filter on by value
    public
                    addFilter(string $field, string|array<string|int, mixed>|Criteria $value) : $this
    Parameters
- $field : string
 - 
                    
Field to filter on
 - $value : string|array<string|int, mixed>|Criteria
 - 
                    
Value for this field
 
Return values
$thisaddHighlight()
Add a highlight parameter
    public
                    addHighlight( $field) : $this
    Parameters
Return values
$thisaddOrFacetFilter()
Add faceting that need to be faceted in an OR formats
    public
                    addOrFacetFilter(string $field, string|array<string|int, mixed> $value) : $this
    Parameters
- $field : string
 - 
                    
Field to facet
 - $value : string|array<string|int, mixed>
 - 
                    
Value to facet
 
Return values
$thisaddSearchTerm()
A simple stub to cover changes between Solr Search modules
    public
                    addSearchTerm(string $text[, null|array<string|int, mixed> $fields = [] ][, int $boost = 0 ]) : $this
    Parameters
- $text : string
 - $fields : null|array<string|int, mixed> = []
 - $boost : int = 0
 
Tags
Return values
$thisaddSort()
Add a field to sort on
    public
                    addSort(string $field, string $direction) : $this
    Parameters
- $field : string
 - $direction : string
 
Return values
$thisaddTerm()
Each boosted query needs a separate addition! e.g. $this->addTerm('test', ['MyField', 'MyOtherField'], 3) followed by $this->addTerm('otherTest', ['Title'], 5);
    public
                    addTerm(string $term[, array<string|int, mixed> $fields = [] ][, int $boost = 0 ][, bool|float $fuzzy = null ]) : $this
    If you want a generic boost on all terms, use addTerm only once, but boost on each field
The fields parameter is used to boost on
For generic boosting, use @addBoostedField($field, $boost), this will add the boost at Index time
Parameters
- $term : string
 - 
                    
Term to search for
 - $fields : array<string|int, mixed> = []
 - 
                    
fields to boost on
 - $boost : int = 0
 - 
                    
Boost value
 - $fuzzy : bool|float = null
 - 
                    
True or a value to the maximum amount of iterations
 
Return values
$thisgetAndFacetFilter()
Stub for AND facets to be get
    public
                    getAndFacetFilter() : array<string|int, mixed>
    Return values
array<string|int, mixed>getBoostedFields()
Get the boosted fields
    public
                    getBoostedFields() : array<string|int, mixed>
    Return values
array<string|int, mixed>getClasses()
Get classes
    public
                    getClasses() : array<string|int, mixed>
    Return values
array<string|int, mixed>getExclude()
Get the excludes
    public
                    getExclude() : array<string|int, mixed>
    Return values
array<string|int, mixed>getFacetFields()
Get the facet fields
    public
                    getFacetFields() : array<string|int, mixed>
    Return values
array<string|int, mixed>getFacetFilter()
Get the AND facet filtering
    public
                    getFacetFilter() : array<string|int, mixed>
    Return values
array<string|int, mixed>getFacetsMinCount()
Get the facet count minimum to use
    public
                    getFacetsMinCount() : int
    Return values
intgetFields()
Get the fields to return
    public
                    getFields() : array<string|int, mixed>
    Return values
array<string|int, mixed>getFilter()
Get the filters
    public
                    getFilter() : array<string|int, mixed>
    Return values
array<string|int, mixed>getHighlight()
Get the highlight parameters
    public
                    getHighlight() : array<string|int, mixed>
    Return values
array<string|int, mixed>getLimit()
Get the rows that are to be returned Compatibility stub
    public
                    getLimit() : int
    Tags
Return values
intgetOrFacetFilter()
Get the OR based facet filtering
    public
                    getOrFacetFilter() : array<string|int, mixed>
    Return values
array<string|int, mixed>getRows()
Get the rows to return
    public
                    getRows() : int
    Return values
intgetSort()
Get the sort fields
    public
                    getSort() : array<string|int, mixed>
    Return values
array<string|int, mixed>getStart()
Get the offset to start
    public
                    getStart() : int
    Return values
intgetTerms()
Get the search terms
    public
                    getTerms() : array<string|int, mixed>
    Return values
array<string|int, mixed>hasSpellcheck()
Do we have spellchecking
    public
                    hasSpellcheck() : bool
    Return values
boolsetAndFacetFilter()
Stub for AND facets to be set
    public
                    setAndFacetFilter(array<string|int, mixed> $facetFilter) : BaseQuery
    Parameters
- $facetFilter : array<string|int, mixed>
 
Return values
BaseQuerysetBoostedFields()
Boosted fields are used at index time, not at query time
    public
                    setBoostedFields(array<string|int, mixed> $boostedFields) : $this
    Parameters
- $boostedFields : array<string|int, mixed>
 
Return values
$thissetClasses()
Set the classes
    public
                    setClasses(array<string|int, mixed> $class) : $this
    Parameters
- $class : array<string|int, mixed>
 
Return values
$thissetExclude()
Set the query excludes
    public
                    setExclude(array<string|int, mixed> $exclude) : $this
    Parameters
- $exclude : array<string|int, mixed>
 
Return values
$thissetFacetFields()
Set the facet fields
    public
                    setFacetFields(array<string|int, mixed> $facetFields) : $this
    Parameters
- $facetFields : array<string|int, mixed>
 
Return values
$thissetFacetFilter()
Set the AND based facet filtering
    public
                    setFacetFilter(array<string|int, mixed> $facetFilter) : BaseQuery
    Parameters
- $facetFilter : array<string|int, mixed>
 
Return values
BaseQuerysetFacetsMinCount()
Set the minimum count of facets to be returned
    public
                    setFacetsMinCount(mixed $facetsMinCount) : $this
    Parameters
- $facetsMinCount : mixed
 
Return values
$thissetFields()
Set fields to be returned
    public
                    setFields(array<string|int, mixed> $fields) : $this
    Parameters
- $fields : array<string|int, mixed>
 
Return values
$thissetFilter()
Set the query filters
    public
                    setFilter(array<string|int, mixed> $filter) : $this
    Parameters
- $filter : array<string|int, mixed>
 
Return values
$thissetFollowSpellcheck()
Set if we should follow spellchecking
    public
                    setFollowSpellcheck(bool $followSpellcheck) : BaseQuery
    Parameters
- $followSpellcheck : bool
 
Return values
BaseQuerysetHighlight()
Set the highlight parameters
    public
                    setHighlight(array<string|int, mixed> $highlight) : $this
    Parameters
- $highlight : array<string|int, mixed>
 
Return values
$thissetLimit()
Set the rows that are to be returned Compatibility stub
    public
                    setLimit(int $limit) : $this
    Parameters
- $limit : int
 
Tags
Return values
$thissetOrFacetFilter()
Set the OR based facet filtering
    public
                    setOrFacetFilter(array<string|int, mixed> $facetFilter) : BaseQuery
    Parameters
- $facetFilter : array<string|int, mixed>
 
Return values
BaseQuerysetRows()
Set the rows to return
    public
                    setRows(int $rows) : $this
    Parameters
- $rows : int
 
Return values
$thissetSort()
Set the sort fields
    public
                    setSort(array<string|int, mixed> $sort) : $this
    Parameters
- $sort : array<string|int, mixed>
 
Return values
$thissetSpellcheck()
Set the spellchecking on this query
    public
                    setSpellcheck(bool $spellcheck) : self
    Parameters
- $spellcheck : bool
 
Return values
selfsetStart()
Set the offset to start
    public
                    setStart(int $start) : $this
    Parameters
- $start : int
 
Return values
$thissetTerms()
Set the search tearms
    public
                    setTerms(array<string|int, mixed> $terms) : $this
    Parameters
- $terms : array<string|int, mixed>
 
Return values
$thisshouldFollowSpellcheck()
Should spellcheck suggestions be followed
    public
                    shouldFollowSpellcheck() : bool