Properties

$stopwords

$stopwords : 

Type

Methods

__construct()

__construct() : void

Initialises the search class

snippet()

snippet(string  $content) : string

Extracts a result snippet from a string of text

Parameters

string $content

The content to snippetify

Returns

string —

the (maybe) highlighted snippet

get_posts()

get_posts(integer  $limit, integer  $offset) : array

Gets a list of published posts

Parameters

integer $limit

The maximum number of posts to fetch

integer $offset

The minimum id to begin from

Returns

array —

an array of posts

get_non_indexed_posts()

get_non_indexed_posts(  $count) : array

Gets a list of published non-indexed posts

Parameters

$count

Returns

array —

an array of posts

search()

search(  $q) : array

Searches the index for a given query

Parameters

$q

Returns

array —

an array of found post ids

log_query()

log_query(  $q,   $count) : void

Logs a given search query

Parameters

$q
$count

create_demo_queries()

create_demo_queries() : void

Logs demo searches

read_pdf()

read_pdf(  $path) : string

Reads the contents of the given pdf file

Parameters

$path

Returns

string —

a string containing the pdfs content

total_indexed()

total_indexed() : integer

Returs total number of indexed posts

Returns

integer —

id of the last indexed post

last_indexed()

last_indexed() : integer

Returns the id of the last indexed post

Returns

integer —

id of the last indexed post

total_searches()

total_searches(  $conditions = '1 = 1') : integer

Returns Total number of searches

Parameters

$conditions

Returns

integer —

numeber of searches

previous_searches()

previous_searches(  $conditions = '') : array

Fetches previous searches

Parameters

$conditions

Returns

array —

an array of previous searches

show_searches()

show_searches(  $conditions = '',   $echo = true) : void

Displays a table of previous searches

Parameters

$conditions
$echo

indexed_ids()

indexed_ids() : integer

Fetches indexed post ids

Returns

integer —

id of the last indexed post

publish_post()

publish_post(integer  $id, object  $post = false) : void

Fires when a post is being published

Parameters

integer $id

the id of the post to index

object $post

The post object of the current post

maybe_delete_post()

maybe_delete_post(  $new_status,   $old_status,   $post) : void

Fires when a post status transitions

Parameters

$new_status
$old_status
$post

delete_post()

delete_post(integer  $id) : void

Fires when a post is being deleted

Parameters

integer $id

the id of the post to index

index_single()

index_single(integer  $id, object  $post) : void

Adds a sinle post to the index

Parameters

integer $id

the id of the post to index

object $post

The post object of the current post

index_next()

index_next() : void

Indexes the next n posts that have not yet been indexed

prepare_single()

prepare_single(object  $post) : string

Prepares a single WordPress post object

Parameters

object $post

The post to prepare

Returns

string —

a prepared string

prepare()

prepare(string  $a,   $q = false) : array

Prepares a post for indexing

Parameters

string $a

the content to prepare

$q

Returns

array —

an array of the post's words

prepare_terms()

prepare_terms(string  $terms) : array

Preprossess an array of terms

Parameters

string $terms

the terms to process

Returns

array —

an array of the processed terms

_prepare_term()

_prepare_term(string  $term) : void

Walker for editing a single code piece

Parameters

string $term

the term to prepare

remove_modifiers()

remove_modifiers(string  $content) : string

Removes search modifiers from a string

Parameters

string $content

the content to prepare

Returns

string —

the cleaned content

pre_get_posts()

pre_get_posts(object  $query) : array

Fired before the main wp_query runs

Parameters

object $query

The wordpress query being excecuted

Returns

array —

an array of the post's words