Class: Kohana_SphinxQL_Query

Source Location: /kohana/sphinxql/query.php

Class Overview [line 22]


Class for building queries to send to sphinx

Author(s):

Version:

  • 0.1

Copyright:

Variables

Constants

Methods


Child classes:

SphinxQL_Query
Wrapper class for Kohana_SphinxQL_Query

Inherited Variables

Inherited Constants

Inherited Methods



Class Details

Class for building queries to send to sphinx

Tags:

[ Top ]


Class Variables

$_fields = array()

[line 30]

Tags:

  • var - The fields that are to be returned in the result set
  • access - protected

Type: array

Overrides:

[ Top ]

$_group =  null

[line 42]

Tags:

  • var - The GROUP BY field
  • access - protected

Type: array

Overrides:

[ Top ]

$_group_order =  null

[line 46]

Tags:

  • var - The IN GROUP ORDER BY options
  • access - protected

Type: array

Overrides:

[ Top ]

$_indexes = array()

[line 26]

Tags:

  • var - The indexes that are to be searched
  • access - protected

Type: array

Overrides:

[ Top ]

$_limit =  20

[line 58]

Tags:

  • var - The maximum number of results to return
  • access - protected

Type: integer

Overrides:

[ Top ]

$_offset =  0

[line 54]

Tags:

  • var - The offset to start returning results from
  • access - protected

Type: integer

Overrides:

[ Top ]

$_options = array()

[line 62]

Tags:

  • var - A set of OPTION clauses
  • access - protected

Type: array

Overrides:

[ Top ]

$_orders = array()

[line 50]

Tags:

  • var - A set of ORDER clauses
  • access - protected

Type: array

Overrides:

[ Top ]

$_search =  null

[line 34]

Tags:

  • var - A string to be searched for in the indexes
  • access - protected

Type: string

Overrides:

[ Top ]

$_sphinx =  null

[line 66]

Tags:

  • var - A reference to a SphinxQL_Core object, used for the execute() function
  • access - protected

Type: SphinxQL_Core

Overrides:

[ Top ]

$_wheres = array()

[line 38]

Tags:

  • var - A set of WHERE conditions
  • access - protected

Type: array

Overrides:

[ Top ]


Class Methods

__construct

Kohana_SphinxQL_Query __construct( SphinxQL_Core $sphinx)

[line 73]

Constructor

Tags:

  • access - public

Parameters:

[ Top ]

add_field

SphinxQL_Query add_field( string $field, [string $alias = null])

[line 192]

Adds a entry to the list of fields to return from the query.

Tags:

  • access - public

Parameters:

  • string $field - Field to add
  • string $alias - Alias for that field, optional

[ Top ]

add_fields

SphinxQL_Query add_fields( array $array)

[line 213]

Adds multiple entries at once to the list of fields to return.

Takes an array structured as so: array(array('field' => 'user_id', 'alias' => 'user')), ...) The alias is optional.

Tags:

  • access - public

Parameters:

  • array $array - Array of fields to add

[ Top ]

add_index

SphinxQL_Query add_index( string $index)

[line 161]

Adds an entry to the list of indexes to be searched.

Tags:

  • access - public

Parameters:

  • string $index - The index to add

[ Top ]

build

string build( )

[line 110]

Builds the query string from the information you've given.

Tags:

  • return - The resulting query
  • access - public

Parameters:

[ Top ]

execute

array execute( )

[line 475]

Executes the query and returns the results

Tags:

  • return - Results of the query
  • access - public

Parameters:

[ Top ]

group_by

SphinxQL_Query group_by( string $field)

[line 365]

Sets the GROUP BY condition for the query.

Tags:

  • access - public

Parameters:

  • string $field - The field/expression for the condition

[ Top ]

group_order

SphinxQL_Query group_order( string $field, string $sort)

[line 409]

Sets the WITHIN GROUP ORDER BY condition for the query. This is a Sphinx-specific extension to SQL.

Tags:

  • access - public

Parameters:

  • string $field - The field/expression for the condition
  • string $sort - The sort type (can be 'asc' or 'desc', capitals are also OK)

[ Top ]

limit

SphinxQL_Query limit( integer $limit)

[line 303]

Sets the limit for the query

Tags:

  • access - public

Parameters:

  • integer $limit - Limit

[ Top ]

offset

SphinxQL_Query offset( integer $offset)

[line 289]

Sets the offset for the query

Tags:

  • access - public

Parameters:

  • integer $offset - Offset

[ Top ]

option

SphinxQL_Query option( string $name, string $value)

[line 436]

Adds an OPTION to the query. This is a Sphinx-specific extension to SQL.

Tags:

  • access - public

Parameters:

  • string $name - The option name
  • string $value - The option value

[ Top ]

order

SphinxQL_Query order( string $field, string $sort)

[line 393]

Adds an ORDER condition to the query.

Tags:

  • access - public

Parameters:

  • string $field - The field/expression for the condition
  • string $sort - The sort type (can be 'asc' or 'desc', capitals are also OK)

[ Top ]

remove_field

SphinxQL_Query remove_field( string $alias)

[line 234]

Removes a field from the list of fields to search.

Tags:

  • access - public

Parameters:

  • string $alias - Alias of the field to remove

[ Top ]

remove_fields

SphinxQL_Query remove_fields( array $array)

[line 248]

Removes multiple fields at once from the list of fields to search.

Tags:

  • access - public

Parameters:

  • array $array - List of aliases of fields to remove

[ Top ]

remove_group_by

SphinxQL_Query remove_group_by( string $field, string 1)

[line 380]

Removes the GROUP BY condition from the query.

Tags:

  • access - public

Parameters:

  • string 1 - The alias for the result set (optional)
  • string $field - The field/expression for the condition

[ Top ]

remove_group_order

SphinxQL_Query remove_group_order( )

[line 423]

Removes the WITHIN GROUP ORDER BY condition for the query. This is a Sphinx-specific extension to SQL.

Tags:

  • access - public

Parameters:

[ Top ]

remove_index

SphinxQL_Query remove_index( string $index)

[line 175]

Removes an entry from the list of indexes to be searched.

Tags:

  • access - public

Parameters:

  • string $index - The index to remove

[ Top ]

remove_option

SphinxQL_Query remove_option( string $name, [string $value = null])

[line 451]

Removes an OPTION from the query.

Tags:

  • access - public

Parameters:

  • string $name - The option name
  • string $value - The option value, optional

[ Top ]

remove_search

SphinxQL_Query remove_search( )

[line 277]

Removes the search text from the query.

Tags:

  • access - public

Parameters:

[ Top ]

search

SphinxQL_Query search( string $search)

[line 264]

Sets the text to be matched against the index(es)

Tags:

  • access - public

Parameters:

  • string $search - Text to be searched

[ Top ]

sphinx

SphinxQL_Query|SphinxQL_Core|false sphinx( [ $sphinx = null])

[line 94]

Sets or gets the SphinxQL_Core object associated with this query.

If you pass it nothing, it'll return $this->_sphinx If you pass it a SphinxQL_Core object, it'll return $this If you pass it anything else, it'll return false

Tags:

  • return - or $this->_sphinx or error
  • access - public

Parameters:

  • $sphinx -

[ Top ]

where

SphinxQL_Query where( string $field, string $value, [string $operator = null], [string $quote = true])

[line 320]

Adds a WHERE condition to the query.

Tags:

  • access - public

Parameters:

  • string $field - The field/expression for the condition
  • string $value - The field/expression/value to compare the field to
  • string $operator - The operator (=, <, >, etc)
  • string $quote - Whether or not to quote the value, defaults to true

[ Top ]

where_in

SphinxQL_Query where_in( string $field, array $values, [string $how = 'any'])

[line 339]

Adds a WHERE <field> <not> IN (<value x>, <value y>, <value ...>) condition to the query, mainly used for MVAs.

Tags:

  • access - public

Parameters:

  • string $field - The field/expression for the condition
  • array $values - The values to compare the field to
  • string $how - Whether this is a match-all, match-any (default) or match-none condition

[ Top ]

__toString

string __toString( )

[line 82]

Magic method, returns the result of build().

Tags:

  • access - public

Parameters:

[ Top ]


Class Constants


Documentation generated on Sun, 11 Jul 2010 21:43:17 +0900 by phpDocumentor 1.4.3