Skip to content

Commit

Permalink
Lucene design document with sorting support. Implement the next step …
Browse files Browse the repository at this point in the history
…in the search scenario
  • Loading branch information
eee-c committed Apr 30, 2009
1 parent 0c49eae commit 2301548
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions eee.rb
Expand Up @@ -20,6 +20,7 @@
page = params[:page].to_i
skip = (page < 2) ? 0 : ((page - 1) * 20) + 1
data = RestClient.get "#{@@db}/_fti?limit=20&skip=#{skip}&q=#{params[:q]}"

@results = JSON.parse(data)
@query = params[:q]

Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/recipe_search.rb
Expand Up @@ -190,7 +190,7 @@
end

Then /^I should see (\d+) results$/ do |count|
response.should have_selector("table a", :count => count.to_i)
response.should have_selector("table td a", :count => count.to_i)
end

Then /^I should see 3 pages of results$/ do
Expand Down
3 changes: 3 additions & 0 deletions features/support/env.rb
Expand Up @@ -61,6 +61,9 @@
idx(doc);
ret.field('sort_title', doc['title'], 'yes', 'not_analyzed');
ret.field('sort_date', doc['date'], 'yes', 'not_analyzed');
ret.field('date', doc['date'], 'yes');
ret.field('title', doc['title'], 'yes');
Expand Down
2 changes: 1 addition & 1 deletion views/search.haml
@@ -1,7 +1,7 @@
%table
%tr
%th
%a{:href => "/recipes/search?q=foo&sort=name" } Name
%a{:href => "/recipes/search?q=foo&sort=name", :id => "sort-by-name"} Name
%th= "Date"
- @results['rows'].each_with_index do |result, i|
%tr{:class => "row#{i % 2}"}
Expand Down

0 comments on commit 2301548

Please sign in to comment.