public
Description: a maintained fork of Evan Weaver's Ultrasphinx code -- see the escape_sql branch
Homepage: http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html
Clone URL: git://github.com/DrMark/ultrasphinx.git
updating the code to work with the latest will_paginate
DrMark (author)
Tue May 27 20:28:15 -0700 2008
commit  cbe4ef9b00c59e3670e60965595a7c9aa164f914
tree    a5853fb6bb3734a9159977c0240ceefab035bbd5
parent  79378a16423571b9d229e9b30d7de46efec5c5e2
...
271
272
273
274
 
275
276
277
278
 
 
 
 
 
 
279
280
281
...
283
284
285
286
 
287
288
289
...
271
272
273
 
274
275
276
277
 
278
279
280
281
282
283
284
285
286
...
288
289
290
 
291
292
293
294
0
@@ -271,11 +271,16 @@ Note that your database is never changed by anything Ultrasphinx does.
0
     end
0
         
0
     # Returns the last available page number in the result set.  
0
-    def page_count
0
+    def total_pages
0
       require_run    
0
       (total_entries / per_page.to_f).ceil
0
     end
0
-            
0
+
0
+    # to keep backward compatibility with previous version
0
+    def page_count
0
+      total_pages
0
+    end
0
+         
0
     # Returns the previous page number.
0
     def previous_page 
0
       current_page > 1 ? (current_page - 1) : nil
0
@@ -283,7 +288,7 @@ Note that your database is never changed by anything Ultrasphinx does.
0
 
0
     # Returns the next page number.
0
     def next_page
0
-      current_page < page_count ? (current_page + 1) : nil
0
+      current_page < total_pages ? (current_page + 1) : nil
0
     end
0
     
0
     # Returns the global index position of the first result on this page.
...
76
77
78
79
 
80
81
82
...
76
77
78
 
79
80
81
82
0
@@ -76,7 +76,7 @@ class SearchTest < Test::Unit::TestCase
0
     assert_equal @page - 1, @s.previous_page
0
     assert_equal @page + 1, @s.next_page
0
     assert_equal @per_page * (@page - 1), @s.offset
0
-    assert @s.page_count >= @s.total_entries / @per_page.to_f
0
+    assert @s.total_pages >= @s.total_entries / @per_page.to_f
0
    end
0
   
0
   def test_empty_query

Comments