Real time search results


#1

I am new to ruby and rails and am unsure how to accomplish the
following:

I’d like to have a page where the user enters a value in a form field
and have results stream into a results div on the page. Additionally, I
want to:

  • Not limit the result set
  • Allow user to get immediate feedback on what they have entered
  • Allow user to change field contents as results are appearing
  • Have query restart when field value changes

Can anyone point me to an appropriate reference or suggest Rails
constructs to research?

Thanks in advance.


#2

george wrote:

I am new to ruby and rails and am unsure how to accomplish the
following:

I’d like to have a page where the user enters a value in a form field
and have results stream into a results div on the page. Additionally, I
want to:

  • Not limit the result set
  • Allow user to get immediate feedback on what they have entered
  • Allow user to change field contents as results are appearing
  • Have query restart when field value changes

Can anyone point me to an appropriate reference or suggest Rails
constructs to research?

Thanks in advance.

Hi George

Take a look at the “Agile Web development with Rails” book, there is a
section about Ajax and one of its example is “Build Real-time searches
with observers”.

Hope this helps :slight_smile:

Victor


#3

Victor F. wrote:

george wrote:

I am new to ruby and rails and am unsure how to accomplish the
following:

I’d like to have a page where the user enters a value in a form field
and have results stream into a results div on the page. Additionally, I
want to:

  • Not limit the result set
  • Allow user to get immediate feedback on what they have entered
  • Allow user to change field contents as results are appearing
  • Have query restart when field value changes

Can anyone point me to an appropriate reference or suggest Rails
constructs to research?

Thanks in advance.

Hi George

Take a look at the “Agile Web development with Rails” book, there is a
section about Ajax and one of its example is “Build Real-time searches
with observers”.

Hope this helps :slight_smile:

Victor

Victor,

Thanks, I’ve looked at that and implemented something using this
construct, but with large result sets, there is too long a delay before
the data appears. And when it does, it’s all at once. I’m wanting to
view in real time the data being found. A simple meaningless example
would be that each record contains a number 1 to a million. When the
user starts typing a 1, the results would include 1, 10-19, 21, 31, 41,
etc. and would continue to be added to if the user typed nothing else.
If the user adds another 1, then the results box starts over -
displaying 11, 110, 111, 112, 113, etc. and again continues.

Any ideas how that can be accoumplished?

g

g


#4

Charlie B. wrote:

If you’re pulling the results from a database, I’m not sure you can
stream them. Database’s return the results all at once, not one at a
time as it’s found.

On Thu, 2006-06-01 at 18:19 +0200, george wrote:

  • Allow user to change field contents as results are appearing
    section about Ajax and one of its example is "Build Real-time searches
    the data appears. And when it does, it’s all at once. I’m wanting to

g

Charlie B.
http://www.recentrambles.com

True, that gives me an idea of a few things to try. Thanks

g


#5

If you’re pulling the results from a database, I’m not sure you can
stream them. Database’s return the results all at once, not one at a
time as it’s found.

On Thu, 2006-06-01 at 18:19 +0200, george wrote:

  • Allow user to change field contents as results are appearing
    section about Ajax and one of its example is "Build Real-time searches
    the data appears. And when it does, it’s all at once. I’m wanting to

g

Charlie B.
http://www.recentrambles.com