| plugins_indexserver

# Class: Bs_Is_Indexer Source Location: /plugins/indexserver/Bs_Is_Indexer.class.php
### Class Overview
    Bs_Object
       |
       --Bs_Is_Indexer
Indexer of the IndexServer package. #### Author(s): andrej arn <at blueshoes dot org> #### Version: 4.5.$id$ #### Copyright: blueshoes.org | ### Variables $Bs_Is_IndexServer $debug $debugOut $doCollocations $stopWatch | ### Methods Bs_Is_Indexer getMimeTypeHandler getWordID index indexByPath indexBySqlWhere indexByUrl indexRankedData registerMimeTypeHandler unindex unindexRecord _assignLanguage
### 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 138] Indexer of the IndexServer package. note: using different stopword lists for the same application but different fields may be desired, but may fuck up the right neighbor lists. for example you treat the word "new" as stopword in one list, but not in the other. now when a user looks for "brand new something" as term, ... todo: handle studlyCaps in fileNames and directoryTreeNames. (just use Bs_String->studlyCapsToSeparated()) dependencies: Bs_String, Bs_HtmlUtil, Bs_HtmlInfo, Bs_Dir, Bs_HttpClient #### Tags:
copyright: | blueshoes.org
version: | 4.5.$id$
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Variables #### $Bs_Is_IndexServer = [line 145] reference to the "mother" IndexServer object. #### Tags:
access: | public
Type: | object
[ Top ] #### $debug = FALSE [line 179] create debug string? #### Tags:
see: | Bs_Is_Indexer::$debugOut
Type: | bool
[ Top ] #### $debugOut = '' [line 187] debug output string. fetch, dump and reset it yourself whenever needed. #### Tags:
see: | Bs_Is_Indexer::$debug
Type: | string
[ Top ] #### $doCollocations = FALSE [line 224] if collocations should be indexed or not. default is FALSE. takes absolutely the most time of the whole process. //the NEAR search feature is not implemented yet in the searcher. until //then it does not make much sense to waste so much time. #### Tags:
access: | public
Type: | bool
[ Top ] #### $stopWatch = [line 233] instance od Bs_StopWatch. gets created in the constructor for benchmarking, seeing where bottlenecks are, debugging etc. #### Tags:
access: | public
Type: | object
[ Top ] ### Class Methods ### constructor Bs_Is_Indexer [line 244]
`Bs_Is_Indexer Bs_Is_Indexer( object &$Bs_Is_IndexServer, object &$profile, object &$bsDb)`
constructor. please use the Bs_Is_IndexServer class to get a new Bs_Is_Indexer instance. #### Tags:
access: | public
#### Parameters:
object | &$Bs_Is_IndexServer |
object | &$profile |
object | &$bsDb |
[ Top ] ### method getMimeTypeHandler [line 323]
`&object &getMimeTypeHandler( string $mime, [string $type = 'mimeTypes'])`
returns a reference to a registered mimeType handler object. #### Tags:
throws: | bool FALSE (if not registered.)
access: | public
#### Parameters:
string | $mime | (mimeTypes like 'text/html' or fileEndings like 'html'.)
string | $type | (default is 'mimeTypes', can also be 'fileEndings'.)
[ Top ] ### method getWordID [line 819]
`mixed getWordID( string $word)`
returns the id for a given word. returns bool FALSE if that word is not indexed/known yet. optimization: this method keeps a little stack of the last accessed words. this is useful especially for the storing of the right neighbor, example: we index "pole position". at first we add the word "position", then the word "pole", and when indexing "pole" we need the id of "position" again. #### Tags:
return: | (int or bool FALSE)
throws: | bs_exception
access: | public
#### Parameters:
string | $word |
[ Top ] ### method index [line 342]
`bool index( mixed $key, mixed $data, [array $props = NULL])`
indexes the given data. unindexes the record before indexing it, if it was already there. #### Tags:
since: | bs4.3
throws: | bs_exception
#### Parameters:
mixed | $key | (unique identifier, int or string)
mixed | $data | (string or hash)
array | $props | (default is NULL)
[ Top ] ### method indexByPath [line 466]
`bool indexByPath( string $fileFullPath, [mixed $key = NULL], [array $props = NULL])`
index the content of a file (on the local file system) specified. #### Tags:
see: | $this->index() etc
since: | bs4.3
access: | public
#### Parameters:
string | $fileFullPath |
mixed | $key | (unique identifier, int or string, default is NULL which means use param $fileFullPath as key.)
array | $props | (default is NULL)
[ Top ] ### method indexBySqlWhere [line 542]
`void indexBySqlWhere( mixed $where)`
#### Tags:
todo: | all
[ Top ] ### method indexByUrl [line 399]
`bool indexByUrl( string $url, [mixed $key = NULL], [array $props = NULL])`
index the content of an url specified. #### Tags:
see: | $this->index() etc
since: | bs4.3
access: | public
#### Parameters:
string | $url |
mixed | $key | (unique identifier, int or string, default is NULL which means use param $url as key.)
array | $props | (default is NULL)
[ Top ] ### method indexRankedData [line 604]
`bool indexRankedData( mixed $key, array $rankedData)`
indexes the ranked data (the data where everything is ready). unindexes the key before in case it was already there. #### Tags:
since: | bs4.3
throws: | bs_exception
#### Parameters:
mixed | $key | (unique identifier, int or string)
array | $rankedData |
[ Top ] ### method registerMimeTypeHandler [line 296]
`bool registerMimeTypeHandler( object &$obj, [string $mimeType = NULL], [string $fileEnding = NULL])`
registers a new handler for a mime type specified. if there is already a handler for something it will be overwritten with the one you give. useful to handle all sorts of formats, even such for which support is not shipped with blueshoes. example: to register a handler for pdf files, you can do $pdfHandler &= new YourPdfHandler(); $indexer->registerMimeTypeHandler($pdfHandler, 'application/pdf', 'pdf'); this will then be used for files ending ".pdf" and for things (from http or so) with the mime type "application/pdf". it is not necessary to give both params, $mimeType and $fileEnding #### Tags:
return: | TRUE (maybe later it will return FALSE if something is not ok.)
since: | bs4.3
see: | var $this->_mimeTypeHandlers
access: | public
#### Parameters:
object | &$obj |
string | $mimeType |
string | $fileEnding |
[ Top ] ### method unindex [line 781]
`bool unindex( mixed $key)`
removes a key from the index, all relations to words, and all words that are not used anymore. #### Tags:
return: | TRUE
since: | bs4.3
throws: | bs_exception (todo)
access: | public
#### Parameters:
mixed | $key | (unique identifier, int or string)
[ Top ] ### method unindexRecord [line 768]
`bool unindexRecord( int $recordID)`
removes a record from the index. #### Tags:
return: | TRUE
deprecated: | as of bs4.3, use unindex() instead.
throws: | bs_exception (todo)
access: | public
#### Parameters:
int | $recordID |
[ Top ] ### method _assignLanguage [line 752]
`void _assignLanguage( array &$wordList, mixed $lang)`
assigns the language codes to the word list. #### Tags:
todo: | if $lang is an array then decide which to use, or assign more than one. do something.
since: | bs4.3
access: | public
#### Parameters:
array | &$wordList |
mixed | $lang | (string or array of possible languages. iso codes like 'de'.)
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:11:28 +0100 by phpDocumentor 1.2.3