Documentation TYPO3 par Ameos

tx_indexedsearch Class Reference

Inheritance diagram for tx_indexedsearch:
[legend]
Collaboration diagram for tx_indexedsearch:
[legend]
List of all members.

Public Member Functions

 main ($content, $conf)
 initialize ()
 getSearchWords ($defOp)
 procSearchWordsByLexer ($SWArr)
 doSearch ($sWArr)
 getResultRows ($sWArr, $freeIndexUid=-1)
 getResultRows_SQLpointer ($sWArr, $freeIndexUid=-1)
 getDisplayResults ($sWArr, $resData, $freeIndexUid=-1)
 compileResult ($resultRows, $freeIndexUid=-1)
 getPhashList ($sWArr)
 execPHashListQuery ($wordSel, $plusQ='')
 sectionTableWhere ()
 mediaTypeWhere ()
 languageWhere ()
 freeIndexUidWhere ($freeIndexUid)
 execFinalQuery ($list, $freeIndexUid=-1)
 checkResume ($row)
 isDescending ($inverse=FALSE)
 writeSearchStat ($sWArr, $count, $pt)
 makeSearchForm ($optValues)
 renderSelectBoxValues ($value, $optValues)
 printRules ()
 printResultSectionLinks ()
 makeSectionHeader ($id, $sectionTitleLinked, $countResultRows)
 printResultRow ($row, $headerOnly=0)
 pi_list_browseresults ($showResultCount=1, $addString='', $addPart='', $freeIndexUid=-1)
 prepareResultRowTemplateData ($row, $headerOnly)
 tellUsWhatIsSeachedFor ($sWArr)
 wrapSW ($str)
 renderSelectBox ($name, $value, $optValues)
 makePointerSelector_link ($str, $p, $freeIndexUid)
 makeItemTypeIcon ($it, $alt='', $specRowConf)
 makeRating ($row)
 makeDescription ($row, $noMarkup=0, $lgd=180)
 markupSWpartsOfString ($str)
 makeTitle ($row)
 makeInfo ($row, $tmplArray)
 getSpecialConfigForRow ($row)
 makeLanguageIndication ($row)
 makeAccessIndication ($id)
 linkPage ($id, $str, $row=array(), $markUpSwParams=array())
 getRootLine ($id, $pathMP='')
 getFirstSysDomainRecordForPage ($id)
 getPathFromPageId ($id, $pathMP='')
 getMenu ($id)
 multiplePagesType ($item_type)
 utf8_to_currentCharset ($str)
hookRequest ($functionName)

Public Attributes

 $prefixId = 'tx_indexedsearch'
 $scriptRelPath = 'pi/class.tx_indexedsearch.php'
 $extKey = 'indexed_search'
 $join_pages = 0
 $defaultResultNumber = 10
 $operator_translate_table
 $wholeSiteIdList = 0
 $sWArr = array()
 $optValues = array()
 $firstRow = Array()
 $cache_path = array()
 $cache_rl = array()
 $fe_groups_required = array()
 $domain_records = array()
 $wSelClauses = array()
 $resultSections = array()
 $external_parsers = array()
 $iconFileNameCache = array()
 $lexerObj
 $templateCode
 $hiddenFieldList = 'ext, type, defOp, media, order, group, lang, desc, results'

Detailed Description

Definition at line 123 of file class.tx_indexedsearch.php.


Member Function Documentation

tx_indexedsearch::main ( content,
conf 
)

Main function, called from TypoScript as a USER_INT object.

Parameters:
string Content input, ignore (just put blank string)
array TypoScript configuration of the plugin!
Returns:
string HTML code for the search form / result display.

Definition at line 169 of file class.tx_indexedsearch.php.

References tslib_pibase::$conf, doSearch(), initialize(), t3lib_div::makeInstance(), makeSearchForm(), tslib_pibase::pi_loadLL(), tslib_pibase::pi_setPiVarDefaults(), tslib_pibase::pi_wrapInBaseClass(), and printRules().

tx_indexedsearch::initialize (  ) 

Initialize internal variables, especially selector box values for the search form and search words

Returns:
void

Definition at line 201 of file class.tx_indexedsearch.php.

References getMenu(), getSearchWords(), t3lib_div::getUserObj(), hookRequest(), t3lib_div::inList(), t3lib_div::intExplode(), t3lib_div::intInRange(), tslib_pibase::pi_getLL(), and t3lib_div::trimExplode().

Referenced by main().

tx_indexedsearch::getSearchWords ( defOp  ) 

Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holds the SQL operator (eg. AND, OR)

Only words with 2 or more characters are accepted Max 200 chars total Space is used to split words, "" can be used search for a whole string (not indexed search then) AND, OR and NOT are prefix words, overruling the default operator +/|/- equals AND, OR and NOT as operators. All search words are converted to lowercase.

$defOp is the default operator. 1=OR, 0=AND

Parameters:
boolean If true, the default operator will be OR, not AND
Returns:
array Returns array with search words if any found

Definition at line 414 of file class.tx_indexedsearch.php.

References hookRequest(), t3lib_div::makeInstance(), and procSearchWordsByLexer().

Referenced by initialize().

tx_indexedsearch::procSearchWordsByLexer ( SWArr  ) 

Post-process the search word array so it will match the words that was indexed (including case-folding if any) If any words are splitted into multiple words (eg. CJK will be!) the operator of the main word will remain.

Parameters:
array Search word array
Returns:
array Search word array, processed through lexer

Definition at line 448 of file class.tx_indexedsearch.php.

Referenced by getSearchWords().

tx_indexedsearch::doSearch ( sWArr  ) 

Performs the search, the display and writing stats

Parameters:
array Search words in array, see ->getSearchWords() for details
Returns:
string HTML for result display.

Definition at line 492 of file class.tx_indexedsearch.php.

References $sWArr, getDisplayResults(), getResultRows(), hookRequest(), t3lib_div::intExplode(), t3lib_div::milliseconds(), tslib_pibase::pi_getLL(), and writeSearchStat().

Referenced by main().

tx_indexedsearch::getResultRows ( sWArr,
freeIndexUid = -1 
)

Get search result rows / data from database. Returned as data in array.

Parameters:
array Search word array
integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns:
array False if no result, otherwise an array with keys for first row, result rows and total number of results found.

Definition at line 550 of file class.tx_indexedsearch.php.

References $firstRow, $sWArr, checkResume(), getResultRows_SQLpointer(), t3lib_div::intInRange(), and multiplePagesType().

Referenced by doSearch().

tx_indexedsearch::getResultRows_SQLpointer ( sWArr,
freeIndexUid = -1 
)

Gets a SQL result pointer to traverse for the search records.

Parameters:
array Search words
integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns:
pointer

Definition at line 624 of file class.tx_indexedsearch.php.

References $sWArr, execFinalQuery(), and getPhashList().

Referenced by getResultRows().

tx_indexedsearch::getDisplayResults ( sWArr,
resData,
freeIndexUid = -1 
)

Compiles the HTML display of the incoming array of result rows.

Parameters:
array Search words array (for display of text describing what was searched for)
array Array with result rows, count, first row.
integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns:
string HTML content to display result.

Definition at line 648 of file class.tx_indexedsearch.php.

References $sWArr, compileResult(), t3lib_div::intInRange(), tslib_pibase::pi_getLL(), pi_list_browseresults(), printResultSectionLinks(), and tellUsWhatIsSeachedFor().

Referenced by doSearch().

tx_indexedsearch::compileResult ( resultRows,
freeIndexUid = -1 
)

Takes the array with resultrows as input and returns the result-HTML-code Takes the "group" var into account: Makes a "section" or "flat" display.

Parameters:
array Result rows
integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns:
string HTML

Definition at line 700 of file class.tx_indexedsearch.php.

References getPathFromPageId(), makeSectionHeader(), tslib_pibase::pi_getLL(), and printResultRow().

Referenced by getDisplayResults().

tx_indexedsearch::getPhashList ( sWArr  ) 

Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the sWArr array. The list of phash integers are unsorted and should be used for subsequent selection of index_phash records for display of the result.

Parameters:
array Search word array
Returns:
string List of integers

Definition at line 802 of file class.tx_indexedsearch.php.

References $sWArr, and execPHashListQuery().

Referenced by getResultRows_SQLpointer().

tx_indexedsearch::execPHashListQuery ( wordSel,
plusQ = '' 
)

Returns a query which selects the search-word from the word/rel tables.

Parameters:
string WHERE clause selecting the word from phash
string Additional AND clause in the end of the query.
Returns:
pointer SQL result pointer

Definition at line 903 of file class.tx_indexedsearch.php.

Referenced by getPhashList().

tx_indexedsearch::sectionTableWhere (  ) 

Returns AND statement for selection of section in database. (rootlevel 0-2 + page_id)

Returns:
string AND clause for selection of section in database.

Definition at line 923 of file class.tx_indexedsearch.php.

References t3lib_div::intExplode().

tx_indexedsearch::mediaTypeWhere (  ) 

Returns AND statement for selection of media type

Returns:
string AND statement for selection of media type

Definition at line 970 of file class.tx_indexedsearch.php.

Referenced by execFinalQuery().

tx_indexedsearch::languageWhere (  ) 

Returns AND statement for selection of langauge

Returns:
string AND statement for selection of langauge

Definition at line 995 of file class.tx_indexedsearch.php.

Referenced by execFinalQuery().

tx_indexedsearch::freeIndexUidWhere ( freeIndexUid  ) 

Where-clause for free index-uid value.

Parameters:
integer Free Index UID value to limit search to.
Returns:
string WHERE SQL clause part.

Definition at line 1007 of file class.tx_indexedsearch.php.

References t3lib_div::revExplode(), and t3lib_div::trimExplode().

Referenced by execFinalQuery().

tx_indexedsearch::execFinalQuery ( list,
freeIndexUid = -1 
)

Execute final query, based on phash integer list. The main point is sorting the result in the right order.

Parameters:
string List of phash integers which match the search.
integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns:
pointer Query result pointer

Definition at line 1048 of file class.tx_indexedsearch.php.

References freeIndexUidWhere(), hookRequest(), t3lib_div::intExplode(), languageWhere(), and mediaTypeWhere().

Referenced by getResultRows_SQLpointer().

tx_indexedsearch::checkResume ( row  ) 

Checking if the resume can be shown for the search result (depending on whether the rights are OK) ? Should it also check for gr_list "0,-1"?

Parameters:
array Result row array.
Returns:
boolean Returns true if resume can safely be shown

Definition at line 1191 of file class.tx_indexedsearch.php.

Referenced by getResultRows().

tx_indexedsearch::isDescending ( inverse = FALSE  ) 

Returns "DESC" or "" depending on the settings of the incoming highest/lowest result order (piVars['desc']

Parameters:
boolean If true, inverse the order which is defined by piVars['desc']
Returns:
string " DESC" or ""

Definition at line 1238 of file class.tx_indexedsearch.php.

tx_indexedsearch::writeSearchStat ( sWArr,
count,
pt 
)

Write statistics information to database for the search operation

Parameters:
array Search Word array
integer Number of hits
integer Milliseconds the search took
Returns:
void

Definition at line 1252 of file class.tx_indexedsearch.php.

References $sWArr, and t3lib_div::getIndpEnv().

Referenced by doSearch().

tx_indexedsearch::makeSearchForm ( optValues  ) 

Make search form HTML

Parameters:
array Value/Labels pairs for search form selector boxes.
Returns:
string Search form HTML

Definition at line 1304 of file class.tx_indexedsearch.php.

References $optValues, tslib_pibase::pi_getLL(), tslib_pibase::pi_getPageLink(), renderSelectBoxValues(), and t3lib_div::trimExplode().

Referenced by main().

tx_indexedsearch::renderSelectBoxValues ( value,
optValues 
)

Function, rendering selector box values.

Parameters:
string Current value
array Array with the options as key=>value pairs
Returns:
string <options> imploded.

Definition at line 1458 of file class.tx_indexedsearch.php.

References $optValues.

Referenced by makeSearchForm().

tx_indexedsearch::printRules (  ) 

Print the searching rules

Returns:
string Rules for the search

Definition at line 1477 of file class.tx_indexedsearch.php.

References tslib_pibase::pi_getLL().

Referenced by main().

tx_indexedsearch::printResultSectionLinks (  ) 

Returns the anchor-links to the sections inside the displayed result rows.

Returns:
string

Definition at line 1496 of file class.tx_indexedsearch.php.

References tslib_pibase::pi_getLL().

Referenced by getDisplayResults().

tx_indexedsearch::makeSectionHeader ( id,
sectionTitleLinked,
countResultRows 
)

Returns the section header of the search result.

Parameters:
string ID for the section (used for anchor link)
string Section title with linked wrapped around
integer Number of results in section
Returns:
string HTML output

Definition at line 1530 of file class.tx_indexedsearch.php.

References tslib_pibase::pi_getLL().

Referenced by compileResult().

tx_indexedsearch::printResultRow ( row,
headerOnly = 0 
)

This prints a single result row, including a recursive call for subrows.

Parameters:
array Search result row
integer 1=Display only header (for sub-rows!), 2=nothing at all
Returns:
string HTML code

Definition at line 1551 of file class.tx_indexedsearch.php.

References hookRequest(), multiplePagesType(), tslib_pibase::pi_getLL(), and prepareResultRowTemplateData().

Referenced by compileResult().

tx_indexedsearch::pi_list_browseresults ( showResultCount = 1,
addString = '',
addPart = '',
freeIndexUid = -1 
)

Returns a results browser

Parameters:
boolean Show result count
string String appended to "displaying results..." notice.
string String appended after section "displaying results..."
string List of integers pointing to free indexing configurations to search. -1 represents no filtering, 0 represents TYPO3 pages only, any number above zero is a uid of an indexing configuration!
Returns:
string HTML output

Definition at line 1620 of file class.tx_indexedsearch.php.

References t3lib_div::intInRange(), makePointerSelector_link(), tslib_pibase::pi_classParam(), and tslib_pibase::pi_getLL().

Referenced by getDisplayResults().

tx_indexedsearch::prepareResultRowTemplateData ( row,
headerOnly 
)

Preparing template data for the result row output

Parameters:
array Result row
boolean If set, display only header of result (for sub-results)
Returns:
array Array with data to insert in result row template

Definition at line 1708 of file class.tx_indexedsearch.php.

References getSpecialConfigForRow(), hookRequest(), linkPage(), makeAccessIndication(), makeDescription(), makeInfo(), makeItemTypeIcon(), makeLanguageIndication(), makeRating(), and makeTitle().

Referenced by printResultRow().

tx_indexedsearch::tellUsWhatIsSeachedFor ( sWArr  ) 

Returns a string that tells which search words are searched for.

Parameters:
array Array of search words
Returns:
string HTML telling what is searched for.

Definition at line 1762 of file class.tx_indexedsearch.php.

References $sWArr, tslib_pibase::pi_getLL(), utf8_to_currentCharset(), and wrapSW().

Referenced by getDisplayResults().

tx_indexedsearch::wrapSW ( str  ) 

Wraps the search words in the search-word list display (from ->tellUsWhatIsSeachedFor())

Parameters:
string search word to wrap (in local charset!)
Returns:
string Search word wrapped in tag.

Definition at line 1796 of file class.tx_indexedsearch.php.

Referenced by tellUsWhatIsSeachedFor().

tx_indexedsearch::renderSelectBox ( name,
value,
optValues 
)

Makes a selector box

Parameters:
string Name of selector box
string Current value
array Array of options in the selector box (value => label pairs)
Returns:
string HTML of selector box

Definition at line 1808 of file class.tx_indexedsearch.php.

References $optValues.

tx_indexedsearch::makePointerSelector_link ( str,
p,
freeIndexUid 
)

Used to make the link for the result-browser. Notice how the links must resubmit the form after setting the new pointer-value in a hidden formfield.

Parameters:
string String to wrap in tag
integer Pointer value
string List of integers pointing to free indexing configurations to search. -1 represents no filtering, 0 represents TYPO3 pages only, any number above zero is a uid of an indexing configuration!
Returns:
string Input string wrapped in tag with onclick event attribute set.

Definition at line 1832 of file class.tx_indexedsearch.php.

Referenced by pi_list_browseresults().

tx_indexedsearch::makeItemTypeIcon ( it,
alt = '',
specRowConf 
)

Return icon for file extension

Parameters:
string File extension / item type
string Title attribute value in icon.
array TypoScript configuration specifically for search result.
Returns:
string tag for icon

Definition at line 1847 of file class.tx_indexedsearch.php.

References t3lib_div::getFileAbsFileName().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::makeRating ( row  ) 

Return the rating-HTML code for the result row. This makes use of the $this->firstRow

Parameters:
array Result row array
Returns:
string String showing ranking value

Definition at line 1889 of file class.tx_indexedsearch.php.

References t3lib_div::intInRange(), and tslib_pibase::pi_getLL().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::makeDescription ( row,
noMarkup = 0,
lgd = 180 
)

Returns the resume for the search-result.

Parameters:
array Search result row
boolean If noMarkup is false, then the index_fulltext table is used to select the content of the page, split it with regex to display the search words in the text.
integer String length
Returns:
string HTML string ...

Definition at line 1933 of file class.tx_indexedsearch.php.

References markupSWpartsOfString(), and utf8_to_currentCharset().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::markupSWpartsOfString ( str  ) 

Marks up the search words from $this->sWarr in the $str with a color.

Parameters:
string Text in which to find and mark up search words. This text is assumed to be UTF-8 like the search words internally is.
Returns:
string Processed content.

Definition at line 1964 of file class.tx_indexedsearch.php.

References t3lib_parsehtml::bidir_htmlspecialchars(), and t3lib_div::intInRange().

Referenced by makeDescription().

tx_indexedsearch::makeTitle ( row  ) 

Returns the title of the search result row

Parameters:
array Result row
Returns:
string Title from row

Definition at line 2044 of file class.tx_indexedsearch.php.

References multiplePagesType(), and utf8_to_currentCharset().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::makeInfo ( row,
tmplArray 
)

Returns the info-string in the bottom of the result-row display (size, dates, path)

Parameters:
array Result row
array Template array to modify
Returns:
array Modified template array

Definition at line 2068 of file class.tx_indexedsearch.php.

References t3lib_div::formatSize(), getPathFromPageId(), and linkPage().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::getSpecialConfigForRow ( row  ) 

Returns configuration from TypoScript for result row based on ID / location in page tree!

Parameters:
array Result row
Returns:
array Configuration array

Definition at line 2100 of file class.tx_indexedsearch.php.

References getRootLine().

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::makeLanguageIndication ( row  ) 

Returns the HTML code for language indication.

Parameters:
array Result row
Returns:
string HTML code for result row.

Definition at line 2124 of file class.tx_indexedsearch.php.

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::makeAccessIndication ( id  ) 

Returns the HTML code for the locking symbol. NOTICE: Requires a call to ->getPathFromPageId() first in order to work (done in ->makeInfo() by calling that first)

Parameters:
integer Page id for which to find answer
Returns:
string tag if access is limited.

Definition at line 2167 of file class.tx_indexedsearch.php.

Referenced by prepareResultRowTemplateData().

tx_indexedsearch::linkPage ( id,
str,
row = array(),
markUpSwParams = array() 
)

Links the $str to page $id

Parameters:
integer Page id
string Title String to link
array Result row
array Additional parameters for marking up seach words
Returns:
string tag wrapped title string.

Definition at line 2182 of file class.tx_indexedsearch.php.

References t3lib_div::getIndpEnv(), getPathFromPageId(), t3lib_div::implodeArrayForUrl(), and tslib_pibase::pi_linkToPage().

Referenced by makeInfo(), and prepareResultRowTemplateData().

tx_indexedsearch::getRootLine ( id,
pathMP = '' 
)

Returns the path to the page $id

Parameters:
integer Page ID
string MP variable content.
Returns:
string Root line for result.

Definition at line 2229 of file class.tx_indexedsearch.php.

Referenced by getPathFromPageId(), and getSpecialConfigForRow().

tx_indexedsearch::getFirstSysDomainRecordForPage ( id  ) 

Gets the first sys_domain record for the page, $id

Parameters:
integer Page id
Returns:
string Domain name

Definition at line 2244 of file class.tx_indexedsearch.php.

Referenced by getPathFromPageId().

tx_indexedsearch::getPathFromPageId ( id,
pathMP = '' 
)

Returns the path to the page $id

Parameters:
integer Page ID
string MP variable content
Returns:
string Path

Definition at line 2257 of file class.tx_indexedsearch.php.

References getFirstSysDomainRecordForPage(), and getRootLine().

Referenced by compileResult(), linkPage(), and makeInfo().

tx_indexedsearch::getMenu ( id  ) 

Return the menu of pages used for the selector.

Parameters:
integer Page ID for which to return menu
Returns:
array Menu items (for making the section selector box)

Definition at line 2309 of file class.tx_indexedsearch.php.

Referenced by initialize().

tx_indexedsearch::multiplePagesType ( item_type  ) 

Returns if an item type is a multipage item type

Parameters:
string Item type
Returns:
boolean True if multipage capable

Definition at line 2328 of file class.tx_indexedsearch.php.

Referenced by getResultRows(), makeTitle(), and printResultRow().

tx_indexedsearch::utf8_to_currentCharset ( str  ) 

Converts the input string from utf-8 to the backend charset.

Parameters:
string String to convert (utf-8)
Returns:
string Converted string (backend charset if different from utf-8)

Definition at line 2338 of file class.tx_indexedsearch.php.

Referenced by makeDescription(), makeTitle(), and tellUsWhatIsSeachedFor().

& tx_indexedsearch::hookRequest ( functionName  ) 

Returns an object reference to the hook object if any

Parameters:
string Name of the function you want to call / hook key
Returns:
object Hook object, if any. Otherwise null.

Definition at line 2348 of file class.tx_indexedsearch.php.

References t3lib_div::getUserObj().

Referenced by doSearch(), execFinalQuery(), getSearchWords(), initialize(), prepareResultRowTemplateData(), and printResultRow().


Member Data Documentation

tx_indexedsearch::$operator_translate_table

Initial value:

 Array (                // case-sensitive. Defines the words, which will be operators between words
                Array ('+' , 'AND'),
                Array ('|' , 'OR'),
                Array ('-' , 'AND NOT'),
                        // english
#               Array ('AND' , 'AND'),
#               Array ('OR' , 'OR'),
#               Array ('NOT' , 'AND NOT'),
        )

Definition at line 131 of file class.tx_indexedsearch.php.


The documentation for this class was generated from the following file:


Généré par L'expert TYPO3 avec  doxygen 1.4.6