\Als_Search

The main search class

Summary

Methods
Properties
Constants
__construct()
search()
$can_search
No constants found
No protected methods found
No protected properties found
N/A
posts_with()
log_query()
No private properties found
N/A

Properties

$can_search

$can_search : boolean

Whether or not we should go ahead with our search

Type

boolean

Methods

__construct()

__construct(  $s) 

Class constructor

Parameters

$s

the query string to search for

search()

search(string  $s) 

Search for the user query

  1. Sanitize the string
  2. Strip stop words
  3. Fetch the posts using the new string

Parameters

string $s

The phrase to search for

posts_with()

posts_with(string  $s) : array

fetch post ids containing each term merge posts that contain more than one term df = no of documents / no. of documents with the term

Parameters

string $s

array of words

Returns

array —

with ids of posts arranged according to relevance

log_query()

log_query(string  $s, integer  $count) 

Save the search term with its results

Parameters

string $s

array of words

integer $count

number of results