[TYPO3-english] Can anyone help me to check this search function?
typo3 study
typostudy at gmail.com
Sat May 19 05:33:12 CEST 2012
function search() {
$template = $this->cObj->getSubpart($this->template,
'###TEMPLATE_SEARCH###');
$markerArray['###ACTION###'] = $markerArray['###ACTION###'] =
$this->pi_getPageLink($GLOBALS['TSFE']->id);
$markerArray['###SEARCH_TITLE###'] =
$this->pi_getLL('text_search_title');
$markerArray['###SEARCH_KEYWORD###'] = '<input class="keyword"
type="text" name="'.$this->prefixId.'[keyword]"'.($this->piVars['keyword']
? ' value="'.stripslashes($this->piVars['keyword']).'"' : '').' />';
$markerArray['###SEARCH###'] =
$this->pi_getLL('text_search_submit');
$content = $this->cObj->substituteMarkerArray($template,
$markerArray);
if ($this->piVars['keyword']) {
$keywords = t3lib_div::trimExplode(' ',
$this->piVars['keyword'], true);
$likeClause = '';
if (sizeof($keywords)) {
foreach ($keywords as $index => $word) {
if ($index > 0) {
$likeClause .= ' OR jc.contents LIKE \'%' .$word.
'%\'';
} else {
$likeClause .= 'jc.contents LIKE \'%' .$word. '%\'';
}
}
if ($likeClause) $likeClause = '('.$likeClause.')';
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'fe.uid, fe.email, fe.city, fe.tx_jcregister_first_name,
fe.tx_jcregister_last_name',
'tx_jcresume_text jc LEFT JOIN fe_users fe ON fe.uid =
jc.cruser_id',
$likeClause.' AND jc.active = 1'
);
...
}
Above function works like this:
If I search A B, it will find the resume with A or B word in that.
such as:1. A is good. 2. B is good. 3. A B is good
Now I want to make it function like this:
I. If I search for A+B and it should find every resume with the words A B
together,
such as: 1. how are you A B?, 2. A B is coming. 3. A B is good.
II. If I search A B, it will find the resume with both of those 2 words in
that, but they do not need be together.
such as: 1.A and B are coming. 2. A will go to B's house. 3. A B are good.
So if I want to see this function, how could I change the above code?
Thanks.
More information about the TYPO3-english
mailing list