| core_lang

# Class: Bs_Is_Index Source Location: /plugins/indexserver/_Bs_Is_Index.class.php
### Class Overview
    Bs_Object
       |
       --Bs_Is_Index
the names of indexes are used case sensitive. but if you try to create one that already exists with different case that will fail cause for that we check case insensitive to avoid problems. #### Author(s): Sam Blum <at blueshoes dot org>, andrej arn <andrej at blueshoes dot org> #### Version: 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:47:48 $ #### Copyright: blueshoes.org | ### Variables $_xml | ### Methods Bs_Is_Index cacheStopWords cleanWord connectDb create drop dropIndex getCleanedWordString getWordArrayFromString getWordID getWordProperties getXml indexRecord indexRecord isReservedName isStopWord load parseSearchInput queueAdd queueRemove removeRecordIndex reset save search searchQueryHelper settingsVarToXml settingsXmlToVar setXml treatSpecialChars uniqueArray
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 42] the names of indexes are used case sensitive. but if you try to create one that already exists with different case that will fail cause for that we check case insensitive to avoid problems. xml definition of the index settings: --------------------------------------------- <blueshoes version="4.0"> <bs:index languages = "" languageDefault = "" db = "" user = "" pass = "" host = "" port = "" manualSqlQuery = "" > <bs:source dbtable="" user="" pass="" host="" port=""> <bs:field name="caption" fieldtype="char" datatype="text" languages="" languageDefault="" weight=""> <bs:field name="description" fieldtype="blob" datatype="html" languages="" languageDefault="" weight="" getSize="-1"> </bs:source> <bs:source dbtable="" user="" pass="" host="" port="" relation=""> <bs:field name="resume" fieldtype="varchar" datatype="url" filetype="word" languages="" languageDefault="" weight="" indexFile="true" getSize="-1"> </bs:source> </bs:index> </blueshoes> --------------------------------------------- dependencies: XPath #### Tags:
copyright: | blueshoes.org
version: | 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:47:48 $
author: | Sam Blum <at blueshoes dot org>, andrej arn <andrej at blueshoes dot org>
[ Top ] ### Class Variables #### $_xml = [line 75] the xml of this index.
Type: | string
[ Top ] ### Class Methods ### constructor Bs_Is_Index [line 85]
`Bs_Is_Index Bs_Is_Index( )`
[ Top ] ### method cacheStopWords [line 1062]
`void cacheStopWords( )`
[ Top ] ### method cleanWord [line 1137]
`void cleanWord( mixed $word, [mixed $rememberSearchStopWords = FALSE])`
[ Top ] ### method connectDb [line 963]
`void connectDb( mixed $param)`
[ Top ] ### method create [line 245]
`bool create( string $name, [string $optimized = 'disk'])`
creates a new index with the given name. creates the db tables for the new index Index_{name}_relation Index_{name}_word inserts the index record into table 'Indexes'. param $optimized: 'disk' => (default) it uses a lot less disk space. (about 1/4) 'speed' => faster search. fixed length rows for the tables. the difference comes from using char fields instead of varchar. #### Tags:
return: | TRUE on success
todo: | add transactions
throws: | bs_exception
access: | public
#### Parameters:
string | $name | the name of the new index. it must be us-ascii [a-zA-Z0-9], *nothing* else.
string | $optimized | one of 'disk' (default) or 'speed'. see above.
[ Top ] ### method drop [line 361]
`void drop( )`
[ Top ] ### method dropIndex [line 380]
`bool dropIndex( string $name)`
drops the given index. all data will be removed (lost). removes the index record in table 'Indexes'. drops the db tables for the given index Index_{name}_relation Index_{name}_word removes existing queued records in the table 'Queue'. #### Tags:
return: | TRUE on success
todo: | add transactions
throws: | bs_exception
access: | public
#### Parameters:
string | $name | the name of the index. it must be us-ascii [a-zA-Z0-9], *nothing* else.
[ Top ] ### method getCleanedWordString [line 1160]
`void getCleanedWordString( mixed $string, [mixed $parseSearch = FALSE])`
[ Top ] ### method getWordArrayFromString [line 1081]
`void getWordArrayFromString( mixed $string)`
[ Top ] ### method getWordID [line 1046]
`void getWordID( mixed $word)`
[ Top ] ### method getWordProperties [line 1012]
`void getWordProperties( mixed $word)`
[ Top ] ### method getXml [line 356]
`void &getXml( mixed &$xml)`
[ Top ] ### method indexRecord [line 806]
`void indexRecord( mixed $name, mixed $recordID)`
[ Top ] ### method indexRecord [line 828]
`boolean; indexRecord( [string $dbName = ""], [string $tableName = ""], [int $recordID = 0])`
this function (re)indexes a record. if the record was already indexed, the old indexes are removed. #### Tags:
return: | true on success, false on failure
version: | 1.0
#### Parameters:
string | $dbName | dbName; the name of the database where the record is
string | $tableName | tableName; the name of the table where the record is
int | $recordID | recordID; the id of the record
[ Top ] ### method isReservedName [line 339]
`bool isReservedName( string $name)`
tells if the name is a reserved index name because of internal use. reserved names currently are (case insensitive): Indexes Queue everything that starts with noiseWords (eg noiseWordsEn) #### Tags:
access: | public
#### Parameters:
string | $name |
[ Top ] ### method isStopWord [line 1074]
`void isStopWord( mixed $word)`
[ Top ] ### method load [line 103]
`bool load( string $name)`
loads the settings of this index. if you have used this object before you need to reset() it first to make it ready for a new index. #### Tags:
return: | TRUE on success
throws: | bool FALSE or bs_exception
access: | public
#### Parameters:
string | $name | the name of the index
[ Top ] ### method parseSearchInput [line 1200]
`void parseSearchInput( mixed $string)`
[ Top ] ### method queueAdd [line 457]
`bool queueAdd( string $name, int $sourceRecordID, [mixed $todo = 'a'])`
adds a record to the index-todo-queue. the record may be added to be (re)indexed or to be removed from the index. behavior of adding: if this record is already in the queue and waiting to be (re)indexed, and you want to index it again, then it won't be added again. it would make no sense. if this record is already in the queue and waiting to be (re)indexed, and you want to remove it from the index (probably because the record has been deleted), then the existing queue-entry will be removed. it is of no use anymore. if the record is waiting to be removed from the index, and you want to queue another delete order, then it won't be added. would make no sense to remove twice. it is *theoretically* possible that a record has been removed from the table and it is marked here to be removed from the index aswell. now in the meantime a record has been added with exactly the same record id. and this one gets added here to the queue. in this case we have to keep the remove-index command, and it will have to be executed before the new record is indexed. this case really is not usual since databases normally don't allow you to use an id when inserting a record that has been in use before. but it still may happen. overview: +-----------------+------------+---------+-------------+ | existing entry | new entry | accept? | new entries | +-----------------+------------+---------+-------------+ | add | add | no | add | | add | remove | yes | remove | | remove | add | yes | remove add | | remove | remove | no | remove | | remove add | add | no | remove add | | remove add | remove | yes | remove | +-----------------+------------+---------+-------------+ #### Tags:
return: | TRUE if it has been added, FALSE if it has not been added (failed, already listed, whatever).
see: | Bs_Is_Index::queueRemove()
access: | public
#### Parameters:
string | $name | the name of the index.
int | $sourceRecordID | the record that you want to have indexed.
[ Top ] ### method queueRemove [line 521]
`int queueRemove( mixed $queueRecordID)`
removes a record from the index-todo-queue. #### Tags:
return: | the number of deleted records
see: | Bs_Is_Index::queueAdd()
throws: | bs_exception on error, bool FALSE if just the count of the deleted records failed.
access: | public
#### Parameters:
mixed | $queueRecordID | the record id from the queue table that you want to delete. an int or a vector filled with integers.
[ Top ] ### method removeRecordIndex [line 813]
`void removeRecordIndex( mixed $name, mixed $recordID)`
[ Top ] ### method reset [line 220]
`void reset( )`
this is the opposite of load(). #### Tags:
access: | public
[ Top ] ### method save [line 210]
`void save( )`
saves the settings of this index. #### Tags:
access: | public
[ Top ] ### method search [line 587]
`void search( [mixed $searchInput = ""], [mixed $preWhere = ""])`
[ Top ] ### method searchQueryHelper [line 786]
`void searchQueryHelper( mixed $query, mixed $points)`
[ Top ] ### method settingsVarToXml [line 202]
`void settingsVarToXml( )`
[ Top ] ### method settingsXmlToVar [line 148]
`void settingsXmlToVar( mixed &$xml)`
[ Top ] ### method setXml [line 352]
`void setXml( mixed &$xml)`
[ Top ] ### method treatSpecialChars [line 1101]
`void treatSpecialChars( [mixed $string = ""], [mixed $replaceWith = " "], [mixed $allowedSpecialCharsArray = ""])`
[ Top ] ### method uniqueArray [line 1251]
`void uniqueArray( mixed $array)`
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:16:40 +0100 by phpDocumentor 1.2.3