Yii 1.1: esearch

ESearch provides an action and some default views for search and order by relevance in MySQL without FULLTEXT.
22 followers

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

Download Last release

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.*',
),

Resources

Total 6 comments

#14469 report it
Sami Ghnaim at 2013/08/14 05:46am
Search from more than one model

How can make this ext search from more than one model

#13783 report it
CGeorge at 2013/06/25 02:52pm
Re: hello!

Kreshnik Arapi, you should put one of that lines inside a view

#11963 report it
Kreshnik Arapi at 2013/02/15 02:01pm
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');
#4377 report it
CGeorge at 2011/07/01 08:53pm
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

#4343 report it
arash at 2011/06/27 03:42pm
minor bugs
  1. $_qsw must be defiend in SearchAction (you just used it for stopWords)

  2. in SearchBoxPortlet, any use of $htmlOptions in init() should change with $this->htmlOptions

  3. 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 . ')';
#4338 report it
abajja at 2011/06/27 11:58am
relevance

can you please explain whaht achieves this calculation:

$weight . '*(length(' . $attribute . ')-length(replace(' . $attribute . ',' . $searchtermTag . ',"")))/length(' . $searchtermTag . ')'

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet