Overview

Packages

  • Admin
  • Archive
  • Common
  • DB
  • Express
  • Form
  • Layout
  • Mailer
  • None
  • OpenHomeoDB
  • PDF
    • MC
  • Process
  • Rep
  • RevRep
  • SaveReps
  • Search
  • Session
  • SymRem
  • TreeView
  • UserDB

Classes

  • Search
  • Overview
  • Package
  • Class
  • Tree

Class Search

The Search class is responsible for building the WHERE part of the symptoms-search query

Package: Search
Category: Homeopathy
Copyright: 2007-2014 Henri Schumacher
License: GNU Affero General Public License v3
Author: Henri Schumacher <henri.hulski@gazeta.pl>
Located at include/classes/search_class.php
Methods summary
public Search
# __construct( )

Class constructor

Class constructor

Returns

Search
public
# build_search( )

build_search is the central function of the Search class that builds the search query

build_search is the central function of the Search class that builds the search query

private
# clean_whitespace( )

clean_whitespace removes whitespace at the beginning and end of the search string and double whitespace inside the search string

clean_whitespace removes whitespace at the beginning and end of the search string and double whitespace inside the search string

private
# delete_punctuation( )

delete_punctuation replaces punctuation inside the search string with a space

delete_punctuation replaces punctuation inside the search string with a space

private
# encode_quotes( )

encode_quotes repaces quotes and escaped quotes in the search string with the escape character constant esc_chr

encode_quotes repaces quotes and escaped quotes in the search string with the escape character constant esc_chr

private
# decode_quotes( )

decode_quotes replaces the escape character constant esc_chr in the search string with a double quote

decode_quotes replaces the escape character constant esc_chr in the search string with a double quote

private
# extract_phrases( )

extract_phrases pulls quoted phrases from the search string and stores them in an array ($this->search_phrase)

extract_phrases pulls quoted phrases from the search string and stores them in an array ($this->search_phrase)

private
# extract_search_not( )

extract_search_not pulls not desired words with a preceded '-' from the search string and stores them in an array ($this->search_not)

extract_search_not pulls not desired words with a preceded '-' from the search string and stores them in an array ($this->search_not)

private
# extract_search_words( )

extract_search_words extract the remaining search words from the search string and stores them in an array ($this->search)

extract_search_words extract the remaining search words from the search string and stores them in an array ($this->search)

private
# build_phrases_search_query( )

build_phrases_search_query builds the SQL search query for the phrases search in regexp-mode

build_phrases_search_query builds the SQL search query for the phrases search in regexp-mode

private
# build_search_not_query( )

build_search_not_query builds the SQL search query for not desired words in regexp-mode

build_search_not_query builds the SQL search query for not desired words in regexp-mode

private
# build_search_query( array|string & $search )

build_search_query builds the SQL search query in regexp-mode

build_search_query builds the SQL search query in regexp-mode

Parameters

$search
array|string
&$search receiving an array containing the search strings, returning a string with the SQL-query ($this->search|$this->search_phrases)
private
# build_boolean_query( string $operator, array|string & $search )

build_boolean_query builds the SQL search query in boolean-mode

build_boolean_query builds the SQL search query in boolean-mode

Parameters

$operator
string
$operator '+'|'-': If '+' the result has to contain this string if '-' it must not
$search
array|string
&$search receiving an array containing the search strings, returning a string with the SQL-query ($this->search|$this->search_phrases|$this->search_not)
private
# dublicate_ss( string $search_ar_name )

dublicate_ss search for a 'ss' or 'ß' in the search string and dublicate them with the counterpart

dublicate_ss search for a 'ss' or 'ß' in the search string and dublicate them with the counterpart

This function closes a bug in the German repertories, where some words sometimes are written with ss and sometimes with ß.

Every string containing 'ss' is dublicated and the 'ss' is replaced by 'ß'. Also every string containing 'ß' is dublicated and the 'ß' is replaced by 'ss'.

Parameters

$search_ar_name
string
$search_ar_name The variable name of the array containing the search strings ('search'|'search_phrase'|'search_not').
private
# merge_dublicate_ss( string $search_ar_name, string $duplicate, integer $key )

merge_dublicate_ss creates the SQL query string for the dublicated search strings containing 'ss' or 'ß'.

merge_dublicate_ss creates the SQL query string for the dublicated search strings containing 'ss' or 'ß'.

Parameters

$search_ar_name
string
$search_ar_name The variable name of the array containing the search strings ('search'|'search_phrase'|'search_not').
$duplicate
string
$duplicate The dublicated search string with the replaced 'ss'|'ß'.
$key
integer
$key The array key of the dublicated search string in the search strings array.
Constants summary
string esc_chr '@'
#

Escape character for encoding quotes

Escape character for encoding quotes

Properties summary
public string|array $search
#

The requested search string after an array with the search words

The requested search string after an array with the search words

private boolean $whole_word
#

If true we're searching for whole words with boolean fulltext search. If false we're searching for parts of words with regular expressions.

If true we're searching for whole words with boolean fulltext search. If false we're searching for parts of words with regular expressions.

private string $and_or
#

'AND'|'OR': If 'AND' the search result should contain all requested words/phrases, if 'OR' any requested words/phrases.

'AND'|'OR': If 'AND' the search result should contain all requested words/phrases, if 'OR' any requested words/phrases.

private string $symptoms_tbl
#

Symptoms table

Symptoms table

private array|string $search_phrase
#

The phrases from the search request first as array later as string prepared for the SQL-query

The phrases from the search request first as array later as string prepared for the SQL-query

private array|string $search_not
#

The words which the search result must not contain first as array later as string prepared for the SQL-query

The words which the search result must not contain first as array later as string prepared for the SQL-query

private string $mode
#

'boolean'|'regexp': 'boolean' if we're using the boolean fulltext search 'regexp' for a search with regular expressions

'boolean'|'regexp': 'boolean' if we're using the boolean fulltext search 'regexp' for a search with regular expressions

private array $dublicated_ss array()
#

Contains the dublicated requested words with ss or ß

Contains the dublicated requested words with ss or ß

OpenHomeopath PHP code documentation API documentation generated by ApiGen 2.8.0