Sunday, September 27, 2009

Re: Search-Engine: Extend results with random records if there are no 'real' results

On Sun, Sep 27, 2009 at 7:52 AM, braaan <martin.plattner@gmail.com> wrote:
>
> On 25 Sep., 20:28, brian <bally.z...@gmail.com> wrote:
>> On Fri, Sep 25, 2009 at 8:47 AM, braaan <martin.platt...@gmail.com> wrote:
>>
>> > i can't use ORDER BY RAND() on every page because
>> > then the user would get different results on every refresh.
>>
>> Well, it wouldn't be very random, otherwise, would it?
>
> you are right, i meant not a new ORDER BY RAND() query on every result-
> page. example: results on page 1 will change when i change the page to
> 2 and then back to 1 again. that's not what i want.
>
>>
>> > i thought about doing the data-fetching myself (andextendif there
>> > are to less results) and give it to the pagination manually, is this
>> > possible?
>>
>> What do you mean by "doing the data-fetching myself " and "manually"?
>
> what i want to do:
> 1) search for the users string myself
> 2) if result-count < X, then add some random results.
> 3) use this resultset (real results + applicable random results) and
> do pagination with exactly this result-set. (not doing a RAND()-query
> on every page-change.)
>
> do you know what i mean?
>

Yes, that makes sense. I suppose you could save the query in the session.

But, why do you want to show random results in the first place? Is
this just for testing? If so, it would be simpler to use dummy data
for now. It doesn't seem tome that showing random results in
production would be useful. If a search query comes up empty, it's
empty.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: