Site-Wide-Search

Hai Everyone,

I want to implement site-wide-search feature in my application.

I don’t want to use any search engine for doing that. and most important thing is i have to find the records from all possible table in my MySQL database.

I have to make this as an extension. so that i can easily add that in all of web applications.

Any one help me with that. is there any way to do that.

Please guide me with that.

Kindly Regards,

paapi

You can use Ext for this purpose. It will enable you to include as many as models in your search criteria.

Hey thanks for ur time.

I go through the link u suggested its cool…

Its possible only if u know all model in an application right… Am i guess it right???

But what i want is that without knowing the model(table) names i have to get all possible records that matches the given string in a particular database.

Is that possible or i have to do it through PHP scripts to get the table details from the given database and starts searching with the Ext you suggest.

I think i have explained my thoughts clearly… if you find anything hard to understand let me know will tell in some other way

Thanks again,

I suggest that you look at Zend Lucene. There is a wiki article here:

http://www.yiiframework.com/wiki/248/adding-search-to-yii-blog-example-using-zend-lucene

You will need to use models to create a search index.

If you’re not up to that standard yet then you need to learn some more basics I’m afraid.

Thanks for your time.

Actually i want to create an extension as like what the Zend Lucene doing(as you suggested)

If you want this to work across many applications though, you will need to be able to configure which database tables and columns will be added to the index. Of course these will be different in each application.

For example, in the wiki it creates an index from the "Post" model, indexing the title, url and content columns.


$posts = Post::model()->findAll();

        foreach($posts as $post){

            $doc = new Zend_Search_Lucene_Document();

 

            $doc->addField(Zend_Search_Lucene_Field::Text('title',

                                          CHtml::encode($post->title), 'utf-8')

            );

You would need to make this generic by looping through an array (perhaps) of models and fields appropriate for each application.

Good luck with your extension :)

Ya thank you for your suggestion…

It will surely helpful for my extension.

I am really new to YII and its extensions and i gone through the ZEND official site. But i couldn’t find any proper documentation for the better understanding of how it actually works… can you suggest me some links to read about the Zend Search

Thanks for your wishes and time.

Kindly Regards,

paapi.