# Ferret "works", but only returns 1 item for a query :(

**URL:** <https://www.ruby-forum.com/t/ferret-works-but-only-returns-1-item-for-a-query/145678>\
**Category:** Ferret\
**Created:** [August 12, 2008, 9:18pm UTC](https://www.ruby-forum.com/t/ferret-works-but-only-returns-1-item-for-a-query/145678 "2008-08-12T21:18:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![efilm66](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/35a633/32.png) [@efilm66](https://www.ruby-forum.com/u/efilm66)\
**Post date:** [August 12, 2008, 9:18pm UTC](https://www.ruby-forum.com/t/ferret-works-but-only-returns-1-item-for-a-query/145678/1 "2008-08-12T21:18:31Z")

</div>

m trying to set up up a basic search bar that will search a table called  
ads. It as 3 fields, the ID, TITLE and DESCRIPTION.

I put “acts\_as\_ferret” in the Ad model. and this code for the search  
box:

1. \<% form\_tag({:action =\> “search”}, :method =\> “get”) do %\>
2. 

3. 

```
  <label for="home_search">Keywords:</label>

```

4. 

```
  <%= text_field_tag "q", params[:q] %>

```

5. 

```
  <input type="submit" value="Search"/>

```

6. 
7. \<%end%\>

And then in the controller for Search action I have:

1. def search
2. if params[:q]
3. 

```
 query = params[:q]

```

4. 

```
 @results = Ad.find_by_contents(query, :limit => :all)

```

5. end
6. end

And then in the search view I have this:

1. \<% @results.each do |i| %\>
2. \<%=i.title%\>&nbsp;&nbsp;\<%=i.description%\>  
3. \<%end%\>

It kinda works, but it only returns one record for any keyword I try  
when I know it should return more. I tried rebuilding the Ferret index  
and it doesn’t help sad.

Am I missing something?
