Table of Contents

SearchFinder

Layer: Core · Source: lib/core/SearchFinder.php:19 (lines 19–293)


class SearchFinder

Searching keyword from search functionality form

Docblock Metadata

Tag Value
@category Core Class
@author Maoelana Noermoehammad
@license MIT
@version 1.0
@since Since Release 1.0

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (2)

Visibility Type Name Default Line
private (untyped) $dbc 26
protected (untyped) $error 33

Methods (8)

Visibility Method Summary Line
public __construct() Initialize object properties and method 39
public __destruct() (undocumented) 46
public getError() Get error message 56
public sanitizeKeyword() Sanitize search keyword 68
private buildBooleanQuery() Build a FULLTEXT boolean mode query string from user keyword. 101
public searchPost() Search posts 121
public searchPage() Search pages 182
public searchAll() Search both posts and pages 243

__construct()

public function __construct()

lines 39–44 (6)

Initialize object properties and method

and an instance of database connection

Takes no parameters.

__destruct()

public function __destruct()

lines 46–49 (4)

Takes no parameters.

Returns: (none declared)

getError()

public function getError()

lines 56–59 (4)

Get error message

Takes no parameters.

Returns: (none declared) — string|null

sanitizeKeyword()

public function sanitizeKeyword($keyword)

lines 68–92 (25)

Sanitize search keyword

Strips FULLTEXT boolean mode operators to prevent operator injection.

Parameter Type Default Description
$keyword (untyped) required none

Returns: (none declared) — string

buildBooleanQuery()

private function buildBooleanQuery($keyword)

lines 101–111 (11)

Build a FULLTEXT boolean mode query string from user keyword.

Prepends + to each word for AND semantics.

Parameter Type Default Description
$keyword (untyped) required Already-sanitized keyword

Returns: (none declared) — string

searchPost()

public function searchPost($keyword, $page = 1, $perPage = 10)

lines 121–172 (52)

Search posts

Parameter Type Default Description
$keyword (untyped) required none
$page (untyped) 1 none
$perPage (untyped) 10 none

Returns: (none declared) — array

searchPage()

public function searchPage($keyword, $page = 1, $perPage = 10)

lines 182–233 (52)

Search pages

Parameter Type Default Description
$keyword (untyped) required none
$page (untyped) 1 none
$perPage (untyped) 10 none

Returns: (none declared) — array

searchAll()

public function searchAll($keyword, $page = 1, $perPage = 10)

lines 243–292 (50)

Search both posts and pages

Parameter Type Default Description
$keyword (untyped) required none
$page (untyped) 1 none
$perPage (untyped) 10 none

Returns: (none declared) — array


This page is generated from source by 'tools/gendoc'. Edits will be overwritten.