Searching using ajax


#1

hi,

i have implimented one application with search facility.
Now i want u se the ajax application for searching using the tags
created?
how can we do that?

if some one worked on this help me.

thanks
srikanth


#2

sreekanth.G wrote:

i have implimented one application with search facility.
Now i want u se the ajax application for searching using the tags created?
how can we do that?

Saying you want to use Ajax there is “solution probleming” - the
opposite of
“problem solving”. You have thought of a solution, and want it to match
the problem!

What user experience do you expect? If you have a tag cloud, users can
click on
it with lowly tags, and they will hit a controller and
search…


Phlip


#3

hi pilip,

simple search with ajax is working fine for me.
Problem is if i give some tagname using acts_as_taggable_on_steroids
to the table entries im getting error like no record found:

example:
strams table contents and corresponding tags showned below:

id name resolution framerate location bitrate tagname
1 ac.264 720x480 30fps c:/data 4mbps 264

from the above if i enter a name of table entry like :
ac.264 in the search box its giving corresponding names having the
table with that name i.e ab.264

corresponding method defined in controller is:

def get_results
if request.xhr?
if params[‘search_text’].strip.length > 0
terms = params[‘search_text’].split.collect do |word|
“%#{word.downcase}%”
end
@streams= Stream.find(
:all,
:conditions => [
( ["(LOWER(title) LIKE ?)"] * terms.size ).join(" AND "),
* terms.flatten
]
)
end
render :partial => “search”
else
redirect_to :action => “index”
end
end
end

im the same way i tried to search using tag name like;
if i enter 264 as tag name in search box what i am expecting is the
corresponding table entries like
ac.264 720x480 30fps c:/data 4mbps

to achieve this i modified the method in controller like:

def get_results
if request.xhr?
if params[‘search_text’].strip.length > 0
terms = params[‘search_text’].split.collect do |word|
“%#{word.downcase}%”
end
@streams= Stream.find_taggable_with(params[:terms])
end
render :partial => “search”
else
redirect_to :action => “index”
end
end
end

here if i enter the tag name its giving the result as :
no record found from get_results

can you tell me where exactly i am doing mistake and need to do
modifications.

thanks alot
srikanth