I18N_Arabic

# Class: I18N_Arabic_Query

Source Location: /Arabic/Query.php

### Class Overview

This PHP class build WHERE condition for SQL statement using MySQL REGEXP and Arabic lexical rules

#### Author(s):

- Khaled Al-Sham'aa <khaled@ar-php.org>

#### Copyright:

- 2006-2016 Khaled Al-Sham'aa

### Methods

- __construct
- allForms
- allWordForms
- getArrFields
- getMode
- getOrderBy
- getStrFields
- getWhereCondition
- getWordLike
- getWordRegExp
- lex
- setArrFields
- setMode
- setStrFields

### Class Details

[line 186]
This PHP class build WHERE condition for SQL statement using MySQL REGEXP and Arabic lexical rules

#### Tags:

author: | Khaled Al-Sham'aa <khaled@ar-php.org>
copyright: | 2006-2016 Khaled Al-Sham'aa
link: | http://www.ar-php.org
license: | LGPL

[ Top ]

### Class Methods

### constructor __construct [line 196]

`I18N_Arabic_Query __construct( )`

Loads initialize values

#### Tags:

access: | public

[ Top ]

### method allForms [line 571]

`string allForms( string $arg)`

Get most possible Arabic lexical forms of user search keywords

#### Tags:

return: | list of most possible Arabic lexical forms for given keywords
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $arg | String that user search for

[ Top ]

### method allWordForms [line 474]

`string allWordForms( string $word)`

Get most possible Arabic lexical forms for a given word

#### Tags:

return: | list of most possible Arabic lexical forms for a given word
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $word | String that user search for

[ Top ]

### method getArrFields [line 285]

`array getArrFields( )`

Getting values of $_fields Array in array format

#### Tags:

return: | Value of $_fields array in Array format
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

[ Top ]

### method getMode [line 273]

`integer getMode( )`

Getting $mode propority value that refer to search mode [0 for OR logic | 1 for AND logic]

#### Tags:

return: | Value of $mode properity
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

[ Top ]

### method getOrderBy [line 416]

`string getOrderBy( string $arg)`

Get more relevant order by section related to the user search keywords

#### Tags:

return: | sub SQL ORDER BY section
author: | Saleh AlMatrafe <saleh@saleh.cc>
access: | public

#### Parameters:

string | $arg | String that user search for in the database table

[ Top ]

### method getStrFields [line 298]

`string getStrFields( )`

Getting values of $_fields array in String format (comma delimated)

#### Tags:

return: | Values of $_fields array in String format (comma delimated)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

[ Top ]

### method getWhereCondition [line 316]

`string getWhereCondition( string $arg)`

Build WHERE section of the SQL statement using defind lex's rules, search mode [AND | OR], and handle also phrases (inclosed by "") using normal LIKE condition to match it as it is.

#### Tags:

return: | The WHERE section in SQL statement (MySQL database engine format)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $arg | String that user search for in the database table

[ Top ]

### method getWordLike [line 401]

`string getWordLike( string $arg)`

Search condition in SQL format for one word in all defind fields using normal LIKE clause

#### Tags:

return: | sub SQL condition (for internal use)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $arg | String (one word) that you want to build a condition for

[ Top ]

### method getWordRegExp [line 380]

`string getWordRegExp( string $arg)`

Search condition in SQL format for one word in all defind fields using REGEXP clause and lex's rules

#### Tags:

return: | sub SQL condition (for internal use)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $arg | String (one word) that you want to build a condition for

[ Top ]

### method lex [line 459]

`string lex( string $arg)`

This method will implement various regular expressin rules based on pre-defined Arabic lexical rules

#### Tags:

return: | Regular Expression format to be used in MySQL query statement
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $arg | String of one word user want to search for

[ Top ]

### method setArrFields [line 218]

`object setArrFields( array $arrConfig)`

Setting value for $_fields array

#### Tags:

return: | to build a fluent interface
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

array | $arrConfig | Name of the fields that SQL statement will search them (in array format where items are those fields names)

[ Top ]

### method setMode [line 256]

`object setMode( integer $mode)`

Setting $mode propority value that refer to search mode [0 for OR logic | 1 for AND logic]

#### Tags:

return: | to build a fluent interface
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

integer | $mode | Setting value to be saved in the $mode propority

[ Top ]

### method setStrFields [line 237]

`object setStrFields( string $strConfig)`

Setting value for $_fields array

#### Tags:

return: | to build a fluent interface
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $strConfig | Name of the fields that SQL statement will search them (in string format using comma as delimated)

[ Top ]

Documentation generated on Fri, 01 Jan 2016 10:26:18 +0200 by phpDocumentor 1.4.0