Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: devel

Fetching stories

 

 

Bricolage devel RSS feed   Index | Next | Previous | View Threaded


adrian at gossamer-threads

Apr 29, 2010, 5:44 PM

Post #1 of 4 (1320 views)
Permalink
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


david at kineticode

Apr 29, 2010, 8:17 PM

Post #2 of 4 (1247 views)
Permalink
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


adrian at gossamer-threads

Apr 29, 2010, 8:27 PM

Post #3 of 4 (1240 views)
Permalink
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


david at kineticode

Apr 29, 2010, 8:31 PM

Post #4 of 4 (1240 views)
Permalink
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

Bricolage devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.