Hi all<br><br>I&#39;m having a problem with aaf - i want to do a search and order the results by the ferret score.&nbsp; I also want to paginate the results (20 per page), and to complicate matters further i have an array of &#39;allowed_ids&#39; - this is effectively the pool of resources which the search results are limited to.<br>
<br>So, i want to order by score, pass in some AR conditions, and paginate the results.&nbsp; Currently the pagination seems to be breaking.<br><br>Here&#39;s an example search, paginated with 1000 per page so it effectively gets all the results (there are only 67 for this particular search).&nbsp; I&#39;ve collected the ids of the results just for illustration purposes:<br>
<br>&nbsp;ferret_results =&nbsp; ActsAsFerret::find(&quot;viola&quot;, [TeachingObject,LearningObject],<br>&nbsp;&nbsp; #(ferret) options <br>&nbsp;&nbsp; { :page =&gt; 1,<br>&nbsp;&nbsp;&nbsp;&nbsp; :per_page =&gt; 1000<br>&nbsp;&nbsp; },<br>&nbsp;&nbsp; #find options - need to specify conditions for each searched class individually<br>
&nbsp;&nbsp; {:conditions =&gt; { :teaching_object=&gt;[&quot;<a href="http://resources.id">resources.id</a> in (?)&quot;,allowed_ids], :learning_object=&gt;[&quot;<a href="http://resources.id">resources.id</a> in (?)&quot;,allowed_ids] }<br>
&nbsp;&nbsp; }<br>&nbsp;).collect(&amp;:id)&nbsp;&nbsp;&nbsp; <br>=&gt; [5407, 5427, 5416, 5401, 5411, 5415, 5420, 5421, 5426, 5431, 5435, 5436, 5397, 5403, 5412, 5418, 5419, 5423, 5424, 5429, 5437, 5439, 533, 534, 5405, 5425, 5440, 5402, 5413, 5414, 5417, 5432, 5433, 5438, 5410, 5404, 532, 5399, 5409, 531, 5398, 5400, 5408, 5422, 5428, 5430, 5434, 5406, 5441, 518, 524, 535, 529, 525, 526, 536, 537, 538, 530, 528, 527, 4452, 1709, 5790]<br>
<br>So - if i was to bring the per_page parameter down to 10 then i&#39;d expect to get the first 10 ids from the list above, right?&nbsp; But, that&#39;s not what happens:<br><br>&nbsp;ferret_results =&nbsp; ActsAsFerret::find(&quot;viola&quot;, [TeachingObject,LearningObject],<br>
&nbsp;&nbsp; #(ferret) options <br>&nbsp;&nbsp; { :page =&gt; 1,<br>&nbsp;&nbsp;&nbsp;&nbsp; :per_page =&gt; 10<br>&nbsp;&nbsp; },<br>&nbsp;&nbsp; #find options - need to specify conditions for each searched class individually<br>&nbsp;&nbsp; {:conditions =&gt; { :teaching_object=&gt;[&quot;<a href="http://resources.id">resources.id</a> in (?)&quot;,allowed_ids], :learning_object=&gt;[&quot;<a href="http://resources.id">resources.id</a> in (?)&quot;,allowed_ids] }<br>
&nbsp;&nbsp; }<br>&nbsp;).collect(&amp;:id)&nbsp;&nbsp;&nbsp; <br>=&gt; [532, 531, 518, 524, 529, 525, 526, 530, 528, 527]<br><br>Can anyone tell me if i&#39;m doing something wrong, or a way i can work around this? <br><br>thanks<br>max<br><br><br>