vB_Search_Criteria
in package
uses
vB_Trait_NoSerialize
vB_Search_Criteria
Tags
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- add_channel_filter() : mixed
- Add a channel filter
- add_contenttype_filter() : mixed
- Filter by contenttype
- add_date_filter() : mixed
- Add a filter for date
- add_error() : mixed
- Add an error in processing.
- add_exclude_filter() : mixed
- Add an exclude filter. Will exclude that node's children from the results
- add_filter() : nothing
- vB_Search_Criteria::add_filter() This function adds a generic filter to the criteria.
- add_follow_filter() : mixed
- Add a follow filter
- add_inc_exc_channel_filter() : mixed
- Add a complex channel filter
- add_keyword_filter() : mixed
- Set the keywords
- add_last_filter() : mixed
- Add a filter for date
- add_null_filter() : mixed
- forces a 0 result query and adds a message to the query
- add_post_processors() : mixed
- add_tag_filter() : mixed
- Add a filter for a tag
- add_user_filter() : mixed
- Set the user filter
- add_view_filter() : mixed
- Adds special handleing for different views
- finalize_date_filters() : mixed
- get_bool_filter_for() : mixed
- get_complex_filters() : array<string|int, mixed>
- Get the complex filters defined
- get_equals_filter() : array<string|int, mixed>
- Get the equals filters defined
- get_equals_filters() : array<string|int, mixed>
- Get the equals filters defined
- get_errors() : mixed
- get_filters() : mixed
- get_GT_filters() : array<string|int, mixed>
- Get the equals filters defined
- get_ignored_keywords() : mixed
- get_include_sticky() : mixed
- get_keywords() : array<string|int, mixed>
- Return the parsed keywords to filter
- get_LT_filters() : array<string|int, mixed>
- Get the equals filters defined
- get_notequals_filters() : mixed
- Get the not equals filters defined
- get_post_processors() : mixed
- get_range_filters() : array<string|int, mixed>
- Get the range filters defined
- get_raw_keywords() : string
- Return the parsed keywords to filter
- get_sort() : mixed
- get_sort_direction() : mixed
- get_sort_field() : mixed
- get_target_userid() : mixed
- get_words() : array<string|int, mixed>
- Break the keyword search into words
- getCurrentUser() : mixed
- getDepth() : mixed
- getDepthExact() : mixed
- getDoCount() : mixed
- getIgnoreCache() : bool
- gets the caching flag
- getIncludeStarter() : mixed
- getJSON() : array<string|int, mixed>
- gets the JSON criteria
- getLimitCount() : mixed
- getLimitOffset() : mixed
- getNoLimit() : bool
- gets the nolimit flag
- getNormalized() : array<string|int, mixed>
- gets the normalized criteria
- getSearchContext() : mixed
- has_date_filter() : mixed
- has_errors() : mixed
- has_topic_view_filter() : mixed
- has_view_filter() : mixed
- is_title_only() : bool
- Should the keywords be applied to the title or to both the title and the keywords
- isRestrictive() : bool
- Determine the normalized critera is restrictive enough
- reset_filter() : mixed
- reset_keyword_filter() : mixed
- reset_post_processors() : mixed
- set_include_sticky() : mixed
- set_sort() : mixed
- Set the sort
- setDoCount() : mixed
- setIgnoreCache() : mixed
- (re)sets the caching flag
- setJSON() : mixed
- sets the JSON criteria
- setLimitCount() : mixed
- setLimitOffset() : mixed
- setNoLimit() : mixed
- (re)sets the nolimit flag
- setNormalized() : void
- sets the normalized criteria
- setSearchContext() : mixed
- setUser() : mixed
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
add_channel_filter()
Add a channel filter
public
add_channel_filter(int $channelId[, mixed $depth = false ][, bool $include_starter = false ][, mixed $depth_exact = false ]) : mixed
Parameters
- $channelId : int
- $depth : mixed = false
- $include_starter : bool = false
-
- flag to include the node itself into the list of children
- $depth_exact : mixed = false
add_contenttype_filter()
Filter by contenttype
public
add_contenttype_filter(mixed $contenttypeid[, mixed $op = vB_Search_Core::OP_EQ ]) : mixed
Parameters
- $contenttypeid : mixed
- $op : mixed = vB_Search_Core::OP_EQ
add_date_filter()
Add a filter for date
public
add_date_filter(mixed $direction, mixed $dateline) : mixed
Parameters
- $direction : mixed
- $dateline : mixed
add_error()
Add an error in processing.
public
add_error(mixed ...$error) : mixed
Intended to be used publically and by the advanced search fields
Parameters
- $error : mixed
add_exclude_filter()
Add an exclude filter. Will exclude that node's children from the results
public
add_exclude_filter(mixed $nodeids) : mixed
Parameters
- $nodeids : mixed
add_filter()
vB_Search_Criteria::add_filter() This function adds a generic filter to the criteria.
public
add_filter(string $field, int $op, mixed $value[, bool $is_restrictive = false ][, mixed $is_additive = false ]) : nothing
Should generally be used either internally in the criteria object, or in the add_advanced_fields function on the search type objects. Search consumers should generally be calling higher level functions.
Parameters
- $field : string
- $op : int
- $value : mixed
-
This can be a single value, or an array of values
- $is_restrictive : bool = false
-
Is this filter restrictive? At least one restrictive filter needs to be set to have a valid search.
- $is_additive : mixed = false
Return values
nothingadd_follow_filter()
Add a follow filter
public
add_follow_filter(mixed $type, mixed $userid) : mixed
Parameters
- $type : mixed
- $userid : mixed
add_inc_exc_channel_filter()
Add a complex channel filter
public
add_inc_exc_channel_filter(mixed $filterChannels) : mixed
Parameters
- $filterChannels : mixed
add_keyword_filter()
Set the keywords
public
add_keyword_filter(string $keywords, bool $titleonly) : mixed
Parameters
- $keywords : string
- $titleonly : bool
-
true if onl
add_last_filter()
Add a filter for date
public
add_last_filter(mixed $direction, mixed $dateline) : mixed
Parameters
- $direction : mixed
- $dateline : mixed
add_null_filter()
forces a 0 result query and adds a message to the query
public
add_null_filter(unknown_type $message) : mixed
Parameters
- $message : unknown_type
add_post_processors()
public
add_post_processors(mixed $processor) : mixed
Parameters
- $processor : mixed
add_tag_filter()
Add a filter for a tag
public
add_tag_filter(mixed $tags) : mixed
Parameters
- $tags : mixed
add_user_filter()
Set the user filter
public
add_user_filter(string $username, mixed $exactmatch) : mixed
Parameters
- $username : string
-
. The name of the user.
- $exactmatch : mixed
add_view_filter()
Adds special handleing for different views
public
add_view_filter(string $view) : mixed
Parameters
- $view : string
finalize_date_filters()
public
finalize_date_filters() : mixed
get_bool_filter_for()
public
get_bool_filter_for(mixed $filter) : mixed
Parameters
- $filter : mixed
get_complex_filters()
Get the complex filters defined
public
get_complex_filters([mixed $filterset = 'filters' ]) : array<string|int, mixed>
Parameters
- $filterset : mixed = 'filters'
Return values
array<string|int, mixed> —Array of $filtername => $value for complex filters $value can either be a scalar or an array, but is likely an array
get_equals_filter()
Get the equals filters defined
public
get_equals_filter(mixed $name[, mixed $force_array = false ]) : array<string|int, mixed>
Parameters
- $name : mixed
- $force_array : mixed = false
Return values
array<string|int, mixed> —Array of $filtername => $value for equals filters $value can either be a scalar or an array
get_equals_filters()
Get the equals filters defined
public
get_equals_filters([mixed $filterset = 'filters' ]) : array<string|int, mixed>
Parameters
- $filterset : mixed = 'filters'
Return values
array<string|int, mixed> —Array of $filtername => $value for equals filters $value can either be a scalar or an array
get_errors()
public
get_errors() : mixed
get_filters()
public
get_filters(mixed $field) : mixed
Parameters
- $field : mixed
get_GT_filters()
Get the equals filters defined
public
get_GT_filters([mixed $filterset = 'filters' ]) : array<string|int, mixed>
Parameters
- $filterset : mixed = 'filters'
Return values
array<string|int, mixed> —Array of $filtername => $value for equals filters $value can either be a scalar or an array
get_ignored_keywords()
public
get_ignored_keywords() : mixed
get_include_sticky()
public
get_include_sticky() : mixed
get_keywords()
Return the parsed keywords to filter
public
get_keywords() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of ["word" => $word, "joiner" => $joiner] where $word is the keyword and $joiner indicates how the word should be joined to the query. $joiner should be one of "AND", "OR", or "NOT" with the exception of the first item for which $joiner is NULL. It is up to the search implementation to define exactly how to treat the words specified.
get_LT_filters()
Get the equals filters defined
public
get_LT_filters([mixed $filterset = 'filters' ]) : array<string|int, mixed>
Parameters
- $filterset : mixed = 'filters'
Return values
array<string|int, mixed> —Array of $filtername => $value for equals filters $value can either be a scalar or an array
get_notequals_filters()
Get the not equals filters defined
public
get_notequals_filters([mixed $filterset = 'filters' ]) : mixed
@return array Array of $filtername => $value for not equals filters
$value can either be a scalar or an array
Parameters
- $filterset : mixed = 'filters'
get_post_processors()
public
get_post_processors() : mixed
get_range_filters()
Get the range filters defined
public
get_range_filters([mixed $filterset = 'filters' ]) : array<string|int, mixed>
Parameters
- $filterset : mixed = 'filters'
Return values
array<string|int, mixed> —Array of $filtername => $value for not equals filters $value is [$min, $max]. A null value for $min or $max means no limit in that direction.
get_raw_keywords()
Return the parsed keywords to filter
public
get_raw_keywords() : string
Return the raw query set to the criteria object. Provided in case an implementation cannot or does not want to use the words array above. If the raw query is used then the display string and highlights should be set by the implementation to better reflect how the query is processed.
Return values
stringget_sort()
public
get_sort() : mixed
get_sort_direction()
public
get_sort_direction() : mixed
get_sort_field()
public
get_sort_field() : mixed
get_target_userid()
public
get_target_userid() : mixed
get_words()
Break the keyword search into words
public
get_words(mixed $keywords) : array<string|int, mixed>
Parameters
- $keywords : mixed
Return values
array<string|int, mixed> —-- array of word records ['word' => $word, 'joiner' => {'', 'NOT', 'AND', 'OR'}] The search implementation is expected to use these to build the search query.
getCurrentUser()
public
getCurrentUser() : mixed
getDepth()
public
getDepth() : mixed
getDepthExact()
public
getDepthExact() : mixed
getDoCount()
public
getDoCount() : mixed
getIgnoreCache()
gets the caching flag
public
getIgnoreCache() : bool
Return values
boolgetIncludeStarter()
public
getIncludeStarter() : mixed
getJSON()
gets the JSON criteria
public
getJSON() : array<string|int, mixed>
use getNormalized
Return values
array<string|int, mixed>getLimitCount()
public
getLimitCount() : mixed
getLimitOffset()
public
getLimitOffset() : mixed
getNoLimit()
gets the nolimit flag
public
getNoLimit() : bool
Return values
boolgetNormalized()
gets the normalized criteria
public
getNormalized() : array<string|int, mixed>
Return values
array<string|int, mixed> —$normalized
getSearchContext()
public
getSearchContext() : mixed
has_date_filter()
public
has_date_filter() : mixed
has_errors()
public
has_errors() : mixed
has_topic_view_filter()
public
has_topic_view_filter() : mixed
has_view_filter()
public
has_view_filter(mixed $view) : mixed
Parameters
- $view : mixed
is_title_only()
Should the keywords be applied to the title or to both the title and the keywords
public
is_title_only() : bool
Return values
boolisRestrictive()
Determine the normalized critera is restrictive enough
public
isRestrictive([bool $include_keywords = true ]) : bool
This depends on the normalized criteria having been set.
Parameters
- $include_keywords : bool = true
-
-- in some cases the search implemenations need to know if the filters are restrictive without considering the keywords.
Return values
boolreset_filter()
public
reset_filter(mixed $field) : mixed
Parameters
- $field : mixed
reset_keyword_filter()
public
reset_keyword_filter() : mixed
reset_post_processors()
public
reset_post_processors() : mixed
set_include_sticky()
public
set_include_sticky([mixed $set = true ]) : mixed
Parameters
- $set : mixed = true
set_sort()
Set the sort
public
set_sort(string $field, unknown_type $direction[, mixed $is_additive = true ]) : mixed
Only allow single field sorts
Parameters
- $field : string
- $direction : unknown_type
- $is_additive : mixed = true
setDoCount()
public
setDoCount([mixed $set = false ]) : mixed
Parameters
- $set : mixed = false
setIgnoreCache()
(re)sets the caching flag
public
setIgnoreCache(bool $flag) : mixed
Parameters
- $flag : bool
setJSON()
sets the JSON criteria
public
setJSON(array<string|int, mixed> $JSON) : mixed
use setNormalized
Parameters
- $JSON : array<string|int, mixed>
setLimitCount()
public
setLimitCount([mixed $set = 0 ]) : mixed
Parameters
- $set : mixed = 0
setLimitOffset()
public
setLimitOffset([mixed $set = 0 ]) : mixed
Parameters
- $set : mixed = 0
setNoLimit()
(re)sets the nolimit flag
public
setNoLimit([bool $set = 1 ]) : mixed
Parameters
- $set : bool = 1
setNormalized()
sets the normalized criteria
public
setNormalized(array<string|int, mixed> $normalized) : void
Parameters
- $normalized : array<string|int, mixed>
setSearchContext()
public
setSearchContext([mixed $set = "none" ]) : mixed
Parameters
- $set : mixed = "none"
setUser()
public
setUser(mixed $userid) : mixed
Parameters
- $userid : mixed