Yii Framework Forum: Contents search widget - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Contents search widget Rate Topic: -----

#1 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 15 May 2009 - 04:05 AM

So, you may add the contents search widget to the blog demo as follows. Here is the diff.

http://code.google.c...rce/detail?r=19

Actually, though this is the enhancement of the yii-blogdemo-enhanced, it can be applied to the original blog demo because this does not related to other enhancements much.
0

#2 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 16 May 2009 - 07:15 PM

Quote

Actually, though this is the enhancement of the yii-blogdemo-enhanced, it can be applied to the original blog demo because this does not related to other enhancements much.


I have confirmed this. BTW, as I have raised the discussion on a bug as follows, please be careful. I surely am going to fix it.

http://www.yiiframew...pic,2182.0.html
0

#3 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 18 May 2009 - 05:13 AM

It has been solved. The google code will be fixed shortly.

http://www.yiiframew...pic,2182.0.html
0

#4 User is offline   moho 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 103
  • Joined: 25-April 09

Posted 18 May 2009 - 08:37 AM

Very Good. I am just about to add my tip on how to add search capability.
0

#5 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 18 May 2009 - 08:28 PM

Sorry but it may be incomplete.  :'( I am searching right way to resolve it.
0

#6 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 25 May 2009 - 11:52 PM

I think I was able to fix the bug. You can see the diff at the google code, but I can show the code central for your reference.

http://code.google.c...rce/detail?r=20

protected/controllers/PostController.php:

0

#7 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 09 June 2009 - 11:14 PM

New release. :)

I have added the enhancement of high-lighting the searched words. It is better seeing than reading this explanation. Try out this enhanced blog demo, or even simple blog with search.
0

#8 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 16 June 2009 - 08:04 AM

screenshot:
Posted Image
0

#9 User is offline   jon 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 03-June 09

Posted 28 June 2009 - 12:48 AM

Just want to say: you are so helpful with your examples/demos
Thank you.
0

#10 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 28 June 2009 - 01:08 AM

Thank you :D This encourages me a lot!
0

#11 User is offline   pestaa 

  • past Yii dev member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 705
  • Joined: 07-May 09
  • Location:Hungary

Posted 11 July 2009 - 09:07 AM

Won't formatting break the searching? If you have a single post with the content
something *unexpected*

and you search for "something unexpected", I suppose there won't be any match because of the formatting.

It'd be better, if non-word characters were acceptable between search keywords in my opinion.

Yet there will be questions without answers, because if you had a post something like
pointing to an <a href="http://example.com">external</a> site

and you were looking for "external site", searching would not return this post either.

(You probably want to search in pure markdown text, but the case is not different in it either.)

I'm looking forward to hearing your opinion.
0

#12 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 12 July 2009 - 10:54 PM

Hi pestaa,
I actually had a trouble with markdown languages as you mentioned. At first I tried to search the words in Post.content, but changed my mind to search in Post.contentDisplay with this reason. And I added the functionality to ignore the contents in the tags starting with '<' and ending with '>'. This is the current algorithm. Do you think you may have a better idea?

0

#13 User is offline   pestaa 

  • past Yii dev member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 705
  • Joined: 07-May 09
  • Location:Hungary

Posted 13 July 2009 - 03:24 AM

Your solution is fairly good, although I can still think of an edge case.

Let's assume we have
dash - between

in our post, now if we tried to search for "dash between", won't this script find anything, will it?

Thus I still recommend to accept nonword characters between keywords.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users