SmartSearch
in package
Provides an API for advanced weighted
Tags
Table of Contents
Constants
- FACET_ANY = [self::FACET_MATCH, self::FACET_LINK, self::FACET_LITERAL, self::FACET_OBJECT, self::FACET_CONTINUOUS, self::FACET_MAP]
- FACET_CONTINUOUS = 'continuous'
- FACET_DISCRETE = [self::FACET_LITERAL, self::FACET_OBJECT]
- FACET_LINK = 'linkProperty'
- FACET_LITERAL = 'literal'
- FACET_MAP = 'map'
- FACET_MATCH = 'matchProperty'
- FACET_OBJECT = 'object'
- TAB_FILTERS = "_filters"
- TAB_MATCHES = "_matches"
- TAB_PARENTS = '_parents'
- TAB_SEARCH = "_search"
Properties
- $exactWeight : array<string, object>
- $facets : array<string|int, object>
- $langWeight : float
- $linkFacet : object
- $matchFacet : object
- $pdo : PDO
- $phrase : string
- $queryLog : AbstractLogger|null
- $repo : RepoDb
- $schema : Schema
- $spatialTerm : SearchTerm
Methods
- __construct() : mixed
- closeSearch() : void
- getInitialFacets() : array<string|int, mixed>
- getSearchFacets() : array<string, array<string, mixed>>
- getSearchPage() : Generator<string|int, object>
- search() : void
- setExactWeight() : self
- setFacets() : self
- setLangWeight() : self
- setQueryLog() : self
- addFacetMatches() : void
- combineSearchQueries() : QueryPart
- createFiltersTable() : bool
- getFiltersQuery() : QueryPart
- getFtsQuery() : QueryPart
- getInitialFacetContinues() : array<string|int, mixed>
- getInitialFacetDiscrete() : array<string|int, mixed>
- getInitialFacetMap() : string
- getSpatialQuery() : QueryPart
- getWeightsWith() : QueryPart
- linkNamedEntities() : QueryPart
- postprocessFacets() : array<string|int, mixed>
Constants
FACET_ANY
public
mixed
FACET_ANY
= [self::FACET_MATCH, self::FACET_LINK, self::FACET_LITERAL, self::FACET_OBJECT, self::FACET_CONTINUOUS, self::FACET_MAP]
FACET_CONTINUOUS
public
mixed
FACET_CONTINUOUS
= 'continuous'
FACET_DISCRETE
public
mixed
FACET_DISCRETE
= [self::FACET_LITERAL, self::FACET_OBJECT]
FACET_LINK
public
mixed
FACET_LINK
= 'linkProperty'
FACET_LITERAL
public
mixed
FACET_LITERAL
= 'literal'
FACET_MAP
public
mixed
FACET_MAP
= 'map'
FACET_MATCH
public
mixed
FACET_MATCH
= 'matchProperty'
FACET_OBJECT
public
mixed
FACET_OBJECT
= 'object'
TAB_FILTERS
public
mixed
TAB_FILTERS
= "_filters"
TAB_MATCHES
public
mixed
TAB_MATCHES
= "_matches"
TAB_PARENTS
public
mixed
TAB_PARENTS
= '_parents'
TAB_SEARCH
public
mixed
TAB_SEARCH
= "_search"
Properties
$exactWeight
private
array<string, object>
$exactWeight
= 2.0
$facets
private
array<string|int, object>
$facets
= []
$langWeight
private
float
$langWeight
= 1.5
$linkFacet
private
object
$linkFacet
$matchFacet
private
object
$matchFacet
$pdo
private
PDO
$pdo
$phrase
private
string
$phrase
$queryLog
private
AbstractLogger|null
$queryLog
= null
$repo
private
RepoDb
$repo
$schema
private
Schema
$schema
$spatialTerm
private
SearchTerm
$spatialTerm
Methods
__construct()
public
__construct(PDO $pdo, Schema $schema, string $baseUrl) : mixed
Parameters
- $pdo : PDO
- $schema : Schema
- $baseUrl : string
closeSearch()
public
closeSearch() : void
getInitialFacets()
public
getInitialFacets(string $prefLang[, string $cacheFile = '' ][, bool $force = false ]) : array<string|int, mixed>
Parameters
- $prefLang : string
- $cacheFile : string = ''
- $force : bool = false
Return values
array<string|int, mixed>getSearchFacets()
public
getSearchFacets([string $prefLang = '' ]) : array<string, array<string, mixed>>
Parameters
- $prefLang : string = ''
Return values
array<string, array<string, mixed>>getSearchPage()
public
getSearchPage(int $page, int $pageSize, SearchConfig $config, string $prefLang) : Generator<string|int, object>
Parameters
- $page : int
- $pageSize : int
- $config : SearchConfig
- $prefLang : string
Return values
Generator<string|int, object>search()
public
search(string $phrase[, string $language = '' ][, bool $inBinary = true ][, array<string|int, string> $allowedProperties = [] ][, array<string|int, SearchTerm> $searchTerms = [] ][, null|SearchTerm $spatialTerm = null ][, array<string|int, int> $parentIds = [] ][, int $matchesLimit = 10000 ]) : void
Parameters
- $phrase : string
- $language : string = ''
- $inBinary : bool = true
- $allowedProperties : array<string|int, string> = []
- $searchTerms : array<string|int, SearchTerm> = []
- $spatialTerm : null|SearchTerm = null
- $parentIds : array<string|int, int> = []
- $matchesLimit : int = 10000
setExactWeight()
public
setExactWeight(float $weight) : self
Parameters
- $weight : float
Return values
selfsetFacets()
public
setFacets(array<string|int, object> $facets[, float $defaultWeight = 1.0 ]) : self
Parameters
- $facets : array<string|int, object>
- $defaultWeight : float = 1.0
Return values
selfsetLangWeight()
public
setLangWeight(float $weight) : self
Parameters
- $weight : float
Return values
selfsetQueryLog()
public
setQueryLog(AbstractLogger $log) : self
Parameters
- $log : AbstractLogger
Return values
selfaddFacetMatches()
private
addFacetMatches(QueryPart $query) : void
Parameters
- $query : QueryPart
combineSearchQueries()
private
combineSearchQueries(array<string|int, mixed> $queries, bool $filteredSearch, string $outName) : QueryPart
Parameters
- $queries : array<string|int, mixed>
- $filteredSearch : bool
- $outName : string
Return values
QueryPartcreateFiltersTable()
private
createFiltersTable(array<string|int, SearchTerm> $searchTerms, array<string|int, int> $parentIds) : bool
Parameters
- $searchTerms : array<string|int, SearchTerm>
- $parentIds : array<string|int, int>
Return values
boolgetFiltersQuery()
private
getFiltersQuery() : QueryPart
Return values
QueryPartgetFtsQuery()
private
getFtsQuery(string $phrase, array<string|int, mixed> $allowedProperties, bool $inBinary, string $lang) : QueryPart
Parameters
- $phrase : string
- $allowedProperties : array<string|int, mixed>
- $inBinary : bool
- $lang : string
Return values
QueryPartgetInitialFacetContinues()
private
getInitialFacetContinues(object $facet) : array<string|int, mixed>
Parameters
- $facet : object
Return values
array<string|int, mixed>getInitialFacetDiscrete()
private
getInitialFacetDiscrete(object $facet, string $prefLang) : array<string|int, mixed>
Parameters
- $facet : object
- $prefLang : string
Return values
array<string|int, mixed>getInitialFacetMap()
private
getInitialFacetMap() : string
Return values
stringgetSpatialQuery()
private
getSpatialQuery(SearchTerm $term, array<string|int, mixed> $allowedProperties) : QueryPart
Parameters
- $term : SearchTerm
- $allowedProperties : array<string|int, mixed>
Return values
QueryPartgetWeightsWith()
private
getWeightsWith(array<string, float> $weights, string $weightName[, string $valueType = 'text' ]) : QueryPart
Parameters
- $weights : array<string, float>
- $weightName : string
- $valueType : string = 'text'
Return values
QueryPartlinkNamedEntities()
private
linkNamedEntities(QueryPart $query, string $outName[, string $joinQuery = '' ]) : QueryPart
Parameters
- $query : QueryPart
- $outName : string
- $joinQuery : string = ''
Return values
QueryPartpostprocessFacets()
private
postprocessFacets(array<string|int, mixed> $facets, string $prefLang) : array<string|int, mixed>
Parameters
- $facets : array<string|int, mixed>
- $prefLang : string