Introduction ¶
ESearch provides an action and some default views for search and order by relevance in MySQL without FULLTEXT.
Note: Please post the issues on Github
Download ¶
Documentation ¶
Requirements ¶
- Yii 1.0 or above
- MySQL 5.0 or above
- PHP 5.2
Installation ¶
- Extract the release file under
protected/extensions/esearch
Usage ¶
//controllers/SiteController.php
public function actions(){
return array(
// ...
'search'=>array(
'class'=>'ext.esearch.SearchAction',
'model'=>'Post',
'attributes'=>array('title', 'tags', 'content'),
)
);
}
//views/layout/main.php
$this->widget('ext.search.SearchBoxPortlet');
//or
SearchAction::renderInputBox();
//or
$this->renderPartial('extensions/esearch/views/inputBox.php');
'import'=>array(
// ...
'ext.esearch.*',
),
relevance
can you please explain whaht achieves this calculation:
$weight . '*(length(' . $attribute . ')-length(replace(' . $attribute . ',' . $searchtermTag . ',"")))/length(' . $searchtermTag . ')'
minor bugs
$_qsw must be defiend in SearchAction (you just used it for stopWords)
in SearchBoxPortlet, any use of $htmlOptions in init() should change with $this->htmlOptions
change "" with '' in $orders[] definition (SearchAction:129) to make extension also compatible with Postgresql. final code will be like this:
$weight . '*(length(' . $attribute . ')-length(replace(' . $attribute . ',' . $searchtermTag . ',\'\')))/length(' . $searchtermTag . ')';
bugs fixed & relevance
Thank you, arash, I just submited your changes to github!
https://github.com/jorgebg/yii-esearch/issues/3
abajja, you can find an explanation at:
http://r937.com/keyword_relevance.html
hello!
Excuse me but I am new to yii, can anybody tell me where exactly to put
$this->widget('ext.search.SearchBoxPortlet'); //or SearchAction::renderInputBox(); //or $this->renderPartial('extensions/esearch/views/inputBox.php');
Re: hello!
Kreshnik Arapi, you should put one of that lines inside a view
Search from more than one model
How can make this ext search from more than one model
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.