Class ItemSearch

Description

This Class is used for searching in Items.

The Search is performed within the Content (if available) and the following DB Columns:

  • name
  • description
  • catchwords
Following columns are selected by default:
  • id
  • name
By calling
, you add Columns to your SearchResult. If you - for example - want to show the Catchwords of an Item within the Result Screen, simply call
  1. addResultColumn('catchwords')
on this Object before executing:
  1. search('foo')
. Make sure the Column Name to add is existing, otherwise the Search will fail with an SQL exception!

If you want to perform an Language independet Search, call

.

  • version: $Id: ItemSearch.php,v 1.9 2006/11/26 22:04:39 kpapst Exp $
  • copyright: Copyright (C) 2002-2006 Kevin Papst
  • author: Kevin Papst
  • license: GNU Public License


			
Direct descendents
Class Description
MenuSearch This Class is used for searching in Menus!
Variable Summary
Method Summary
ItemSearch ItemSearch (int $itemtype, int $language)
void addResultColumn (String $column)
void finalize ()
void init ( $itemtype,  $language)
array search (String $searchterm)
void setLimit (int $limit)
void setLimiter (int $start, int $end)
void setSearchContentOnly (boolean $bool)
void setSearchLanguageID (int $id)
Variables
mixed $LANGUAGE_INDEPENDENT = SEARCH_LANGUAGE_INDEPENDENT (line 71)

Use this constant for searching in all languages (Language independent).

  • access: public
  • deprecated: use the constant SEARCH_LANGUAGE_INDEPENDENT instead.
Methods
Constructor ItemSearch (line 102)

Initialize the ItemSearch with Itemtype and language.

ItemSearch ItemSearch (int $itemtype, int $language)
  • int $itemtype: the ItemtypeID to search in
  • int $language: the LanguageID to search for
addResultColumn (line 193)

Adds a Column (from the Item table) that will be selected when searching.

Make sure the Column exists, otherwise the Search will fail!

void addResultColumn (String $column)
  • String $column: the Column Name to select
finalize (line 275)

Call this to make sure all resources are freed.

void finalize ()
init (line 110)
  • access: protected
void init ( $itemtype,  $language)
  • $itemtype
  • $language
search (line 206)

Perform the Search with the configured Options.

An Array of SearchResult Objects is returned. If no result could be found, an empty array will be returned.

  • return: an array of SearchResult Objects
array search (String $searchterm)
  • String $searchterm: the String to search for
setLimit (line 153)

Set the Limit of Search Results.

void setLimit (int $limit)
  • int $limit: a Limit of max. Results
setLimiter (line 163)

Set the Start and End Limits of the Serach Results.

void setLimiter (int $start, int $end)
  • int $start: the Start Value of Results
  • int $end: the End Value of Results
setSearchContentOnly (line 144)

Sets whether we search in Content only or in all available Columns.

void setSearchContentOnly (boolean $bool)
  • boolean $bool: true to search in Content only, false to search all Columns
setSearchLanguageID (line 174)

Set the Searchable Language.

See Class Doc for information about Language independent Search!

void setSearchLanguageID (int $id)
  • int $id: the LanguageID

Documentation generated by phpDocumentor 1.3.1