The list:string is not an alternative to using a tag table and
tag_link many-to-many (an example of which is provided by
plugin_tagging).
Yet you should not have the problem you experience. With recent
versions of web2py, Field('keywords', 'list:string') should be
rendered by a new widget that takes one keyword per line and adds new
lines when yo press enter. You should not be using '|' to separate
keywords. If you do all keywords will be interpreted as one long
keyword containing the '|'s.
Massimo
On Oct 24, 10:35 pm, rick <[email protected]> wrote:
> I'm getting frustrated with the list:string field type.
>
> I store products, each product has "keywords" that describe the
> product.
> db.define_table('products',
> Field('keywords', 'list:string'))
> I don't know what the keywords will be, so I can't use IS_IN_SET()
>
> It seems to stores the keywords fine, as long as (I'm using Crud)
> I separate the keywords like this: green|blue|red
>
> But when I make this call
> rows = db(db.products.keywords.contains(keyword)).select()
> I don't get all the products back that I should! In fact, it seems
> that I need to do an update on the product (again using Crud,
> and any sort of update) before the product's keywords will be
> picked up.
>
> Is this a problem with using Crud?
> In all honesty, I'd be more comfortable not using list:string, and
> having a separate table "keywords" that linked (many-to-one)
> to the products table, but I really don't know how I would even
> begin to do that in web2py..
>
> Thanks for reading!
> - rick