Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcSearchQuerySolr

Search::ezcSearchQuerySolr

Class ezcSearchQuerySolr

ezcSearchQuerySolr implements the find query for searching documents.

Source for this file: /Search/src/abstraction/implementations/solr.php

Implements interfaces:

Version:   //autogen//

Member Variables

public array(string) $facets
Holds all the facets
public array(string) $highlightFields
Holds the columns to highlight in the search result
public int $limit = null
Holds the maximum number of results for the query.

null for unlimited

public int $offset
Holds the number of the first element to return in the results.

This is used in combination with the $limit option.

public array(string) $orderByClauses
Holds all the order by clauses that will be used to create the search query.
public array $resultFields
Holds the columns to return in the search result
public array(string) $whereClauses
Holds all the search clauses that will be used to create the search query.

Method Summary

public ezcSearchQuerySolr __construct( $handler , $definition )
Constructs a new ezcSearchQuerySolr object for the handler $handler
public string between( $field , $value1 , $value2 )
Returns a string containing a field/value specifier, and an optional boost value.
public string boost( $clause , $boostFactor )
Modifies a clause to give it higher weight while searching.
public string eq( $field , $value )
Returns a string containing a field/value specifier, and an optional boost value.
public ezcSearchQuerySolr facet( $facet )
Adds one facet to the query.
public string fuzz( $clause , [ $fuzzFactor = null] )
Modifies a clause make it fuzzy.
public ezcSearchDocumentDefinition getDefinition( )
Returns the definition that belongs to this query
public ezcSearchQuerySolr highlight( $... )
Adds the fields to highlight in the results.
public string important( $clause )
Creates an 'important' clause
public string lAnd( $... )
Creates an AND clause
public ezcSearchQuerySolr limit( $limit , [ $offset = 0] )
Registers from which offset to start returning results, and how many results to return.
public string lOr( $... )
Creates an OR clause
public string not( $clause )
Creates a NOT clause
public ezcSearchQuerySolr orderBy( $field , [ $type = ezcSearchQueryTools::ASC] )
Tells the query on which field to sort on, and in which order
public void reset( )
Resets all the internal query values to their defaults.
public ezcSearchQuerySolr select( $... )
Adds the fields to return in the results.
public ezcSearchQuerySolr where( $clause )
Adds a select/filter statement to the query

Methods

__construct

ezcSearchQuerySolr __construct( ezcSearchHandler $handler , ezcSearchDocumentDefinition $definition )

Constructs a new ezcSearchQuerySolr object for the handler $handler

The handler implements mapping field names and values based on the document $definition.

Parameters:
Name Type Description
$handler ezcSearchHandler
$definition ezcSearchDocumentDefinition
Implementation of:
Method Description
ezcSearchQuery::__construct() Creates a new search query with handler $handler and document definition $definition.

between

string between( string $field , mixed $value1 , mixed $value2 )

Returns a string containing a field/value specifier, and an optional boost value.

The method uses the document definition field type to map the fieldname to a solr fieldname, and the $fieldType argument to escape the values correctly.

Parameters:
Name Type Description
$field string
$value1 mixed
$value2 mixed
Implementation of:
Method Description
ezcSearchQuery::between() Returns a string containing a field/value specifier, and an optional boost value.

boost

string boost( string $clause , float $boostFactor )

Modifies a clause to give it higher weight while searching.

This method accepts a clause and adds a boost factor.

Parameters:
Name Type Description
$clause string
$boostFactor float
Implementation of:
Method Description
ezcSearchFindQuery::boost() Modifies a clause to give it higher weight while searching.

eq

string eq( string $field , mixed $value )

Returns a string containing a field/value specifier, and an optional boost value.

The method uses the document definition field type to map the fieldname to a solr fieldname, and the $fieldType argument to escape the $value correctly. If a definition is set, the $fieldType will be overridden with the type from the definition.

Parameters:
Name Type Description
$field string
$value mixed
Implementation of:
Method Description
ezcSearchQuery::eq() Returns a string containing a field/value specifier, and an optional boost value.

facet

ezcSearchQuerySolr facet( string $facet )

Adds one facet to the query.

Facets should only be used for STRING fields, and not TEXT fields.

Parameters:
Name Type Description
$facet string
Implementation of:
Method Description
ezcSearchFindQuery::facet() Adds one facet to the query.

fuzz

string fuzz( string $clause , [float $fuzzFactor = null] )

Modifies a clause make it fuzzy.

This method accepts a clause and registers it as a fuzzy search, an optional fuzz factor is also supported.

Parameters:
Name Type Description
$clause string
$fuzzFactor float
Implementation of:
Method Description
ezcSearchFindQuery::fuzz() Modifies a clause make it fuzzy.

getDefinition

ezcSearchDocumentDefinition getDefinition( )

Returns the definition that belongs to this query

highlight

ezcSearchQuerySolr highlight( mixed $... )

Adds the fields to highlight in the results.

This method accepts either an array of fieldnames, but can also accept multiple parameters as field names. The following is therefore equivalent:

  1.  $q->highlight( array( 'one', 'two', 'three' ) );
  2.  $q->highlight( 'one', 'two', 'three' ) );

If fields already have been added with this function, they will not be overwritten when this function is called subsequently.

Parameters:
Name Type Description
$... mixed

important

string important( string $clause )

Creates an 'important' clause

This method accepts a clause and marks it as important.

Parameters:
Name Type Description
$clause string
Implementation of:
Method Description
ezcSearchFindQuery::important() Creates an 'important' clause

lAnd

string lAnd( mixed $... )

Creates an AND clause

This method accepts either an array of fieldnames, but can also accept multiple parameters as field names.

Parameters:
Name Type Description
$... mixed
Implementation of:
Method Description
ezcSearchQuery::lAnd() Creates an AND clause

limit

ezcSearchQuerySolr limit( int $limit , [int $offset = 0] )

Registers from which offset to start returning results, and how many results to return.

$limit controls the maximum number of rows that will be returned. $offset controls which row that will be the first in the result set from the total amount of matching rows.

Parameters:
Name Type Description
$limit int
$offset int
Implementation of:
Method Description
ezcSearchFindQuery::limit() Registers from which offset to start returning results, and how many results to return.

lOr

string lOr( mixed $... )

Creates an OR clause

This method accepts either an array of fieldnames, but can also accept multiple parameters as field names.

Parameters:
Name Type Description
$... mixed
Implementation of:
Method Description
ezcSearchQuery::lOr() Creates an OR clause

not

string not( string $clause )

Creates a NOT clause

This method accepts a clause and negates it.

Parameters:
Name Type Description
$clause string
Implementation of:
Method Description
ezcSearchQuery::not() Creates a NOT clause

orderBy

ezcSearchQuerySolr orderBy( string $field , [int $type = ezcSearchQueryTools::ASC] )

Tells the query on which field to sort on, and in which order

You can call orderBy multiple times. Each call will add a column to order by.

Parameters:
Name Type Description
$field string
$type int
Implementation of:
Method Description
ezcSearchFindQuery::orderBy() Tells the query on which field to sort on, and in which order

reset

void reset( )

Resets all the internal query values to their defaults.

Implementation of:
Method Description
ezcSearchQuery::reset() Resets the query object for reuse.

select

ezcSearchQuerySolr select( mixed $... )

Adds the fields to return in the results.

This method accepts either an array of fieldnames, but can also accept multiple parameters as field names. The following is therefore equivalent:

  1.  $q->select( array( 'one', 'two', 'three' ) );
  2.  $q->select( 'one', 'two', 'three' ) );

If fields already have been added with this function, they will not be overwritten when this function is called subsequently.

Parameters:
Name Type Description
$... mixed
Implementation of:
Method Description
ezcSearchFindQuery::select() Opens the query and selects which fields you want to return with the query.

where

ezcSearchQuerySolr where( string $clause )

Adds a select/filter statement to the query

Parameters:
Name Type Description
$clause string
Implementation of:
Method Description
ezcSearchQuery::where() Adds a select/filter statement to the query
Documentation generated by phpDocumentor 1.4.3