jzhong5
(Jzhong5)
June 5, 2012, 1:39pm
1
Hi, everyone,
I am making a search function in my website.
I know that each model has a search function so I can search within this model or in the relative model easily,
However, has anyone tried to search FREELY? So I can make a search function like goole’s site-search or the search in this website(you can search extension, forum, whatever).
Is there a way to build a search class to search all pages in the website(all models)?
Any hints about this site-search/free search/or some tricky/hacky way to acheive the search like the one on Yii’s website?
Thanks!!!!!!
Seal
(Sealtrip)
June 5, 2012, 1:54pm
2
You mean something like this?
jzhong5
(Jzhong5)
June 5, 2012, 4:16pm
4
Just one question…
In the post http://www.yiiframework.com/wiki/248/adding-search-to-yii-blog-example-using-zend-lucene
How could he access each page’s url?? Should I save each page’s url in the database… ? i don’t think that is a good idea…
I tried his code and it always give me
Field name "link" not found in document.
Any ideas…?
It will be useless if i can’t get each page’s url…
Seal
(Sealtrip)
June 6, 2012, 1:27am
5
Jiaming,
No…no, not the database.
Just as you do not store each post url in the database, however the post url is still accessible. The same principle applies here.
<br class="Apple-interchange-newline">So, judging from
$post->url
This basically means that you may define a public property in your model class. Then some method to Yii::app()->createUrl()
to access your site.
I do not think the author wrote it as a copy paste code.
Seal
(Sealtrip)
June 6, 2012, 1:31am
6
In fact, the yii blog will make the point clearer.
The author did say based on yii blog. He’s writing style also leaves the reader with homework exercise.
jzhong5
(Jzhong5)
June 6, 2012, 2:40pm
7
Seal:
Jiaming,
No…no, not the database.
Just as you do not store each post url in the database, however the post url is still accessible. The same principle applies here.
<br class="Apple-interchange-newline">So, judging from
$post->url
This basically means that you may define a public property in your model class. Then some method to Yii::app()->createUrl()
to access your site.
I do not think the author wrote it as a copy paste code.
That is very helpful. Thank you!