Documentation

SmartSearch
in package

Provides an API for advanced weighted

Tags
author

zozlak

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_LITERAL

public mixed FACET_LITERAL = 'literal'

FACET_MATCH

public mixed FACET_MATCH = 'matchProperty'

Properties

$exactWeight

private array<string, object> $exactWeight = 2.0

$facets

private array<string|int, object> $facets = []

$queryLog

private AbstractLogger|null $queryLog = null

Methods

__construct()

public __construct(PDO $pdo, Schema $schema, string $baseUrl) : mixed
Parameters
$pdo : PDO
$schema : Schema
$baseUrl : string

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>
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
self

setFacets()

public setFacets(array<string|int, object> $facets[, float $defaultWeight = 1.0 ]) : self
Parameters
$facets : array<string|int, object>
$defaultWeight : float = 1.0
Return values
self

setLangWeight()

public setLangWeight(float $weight) : self
Parameters
$weight : float
Return values
self

setQueryLog()

public setQueryLog(AbstractLogger $log) : self
Parameters
$log : AbstractLogger
Return values
self

addFacetMatches()

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
QueryPart

createFiltersTable()

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
bool

getFiltersQuery()

private getFiltersQuery() : QueryPart
Return values
QueryPart

getFtsQuery()

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
QueryPart

getInitialFacetContinues()

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
string

getSpatialQuery()

private getSpatialQuery(SearchTerm $term, array<string|int, mixed> $allowedProperties) : QueryPart
Parameters
$term : SearchTerm
$allowedProperties : array<string|int, mixed>
Return values
QueryPart

getWeightsWith()

private getWeightsWith(array<string, float> $weights, string $weightName[, string $valueType = 'text' ]) : QueryPart
Parameters
$weights : array<string, float>
$weightName : string
$valueType : string = 'text'
Return values
QueryPart

linkNamedEntities()

private linkNamedEntities(QueryPart $query, string $outName[, string $joinQuery = '' ]) : QueryPart
Parameters
$query : QueryPart
$outName : string
$joinQuery : string = ''
Return values
QueryPart

postprocessFacets()

private postprocessFacets(array<string|int, mixed> $facets, string $prefLang) : array<string|int, mixed>
Parameters
$facets : array<string|int, mixed>
$prefLang : string
Return values
array<string|int, mixed>

        
On this page

Search results