Mailing List Archive

Fetching stories
Hi Everyone,

I'm currently fetching a list of stories by using:

@stories = Bric::Biz::Asset::Business::Story->list(...);

and this is working fine for relatively simple search parameters (dates,
keywords, titles, etc). However, we need to now do something more
complicated where the story must have one or more keywords, and any of
another set of keywords.

Is this possible to do using the existing API? Ideas, suggestions?

Thanks!

Adrian
Re: Fetching stories [ In reply to ]
On Apr 29, 2010, at 5:44 PM, Adrian Yee wrote:

> Hi Everyone,
>
> I'm currently fetching a list of stories by using:
>
> @stories = Bric::Biz::Asset::Business::Story->list(...);
>
> and this is working fine for relatively simple search parameters (dates, keywords, titles, etc). However, we need to now do something more complicated where the story must have one or more keywords, and any of another set of keywords.
>
> Is this possible to do using the existing API? Ideas, suggestions?

I think you can do `keyword => '%'` to get a list of stories with one or more keywords, but there's no way to do it for 2 or more or three or more.

You can get stories with any of a list of keywords with `keyword => ANY(@list)`.

HTH,

david
Re: Fetching stories [ In reply to ]
On 04/29/10 20:17, David E. Wheeler wrote:
> On Apr 29, 2010, at 5:44 PM, Adrian Yee wrote:
>
>> Hi Everyone,
>>
>> I'm currently fetching a list of stories by using:
>>
>> @stories = Bric::Biz::Asset::Business::Story->list(...);
>>
>> and this is working fine for relatively simple search parameters (dates, keywords, titles, etc). However, we need to now do something more complicated where the story must have one or more keywords, and any of another set of keywords.
>>
>> Is this possible to do using the existing API? Ideas, suggestions?
>
> I think you can do `keyword => '%'` to get a list of stories with one or more keywords, but there's no way to do it for 2 or more or three or more.
>
> You can get stories with any of a list of keywords with `keyword => ANY(@list)`.

I should have been a little clearer. I already use keyword =>
ANY(@keywords), but now I need to do something like (not real code
obviously):

ALL(@all_keywords) and ANY(@any_keywords)

Thanks.

Adrian
Re: Fetching stories [ In reply to ]
On Apr 29, 2010, at 8:27 PM, Adrian Yee wrote:

> I should have been a little clearer. I already use keyword => ANY(@keywords), but now I need to do something like (not real code obviously):
>
> ALL(@all_keywords) and ANY(@any_keywords)

Alas, we have only ANY() and NONE(), not ALL(). Patches welcome, of course.

Best,

David