Thank you, Anthony. The Google Search API is a little too difficult for me
to master, and also is billed.
I tried your other suggestion for simulating the .startswith query, but it
did not work in my case, either.
*MODIFIED CONTROLLER FUNCTION*
*def HomeList():*
* if request.args(0):*
* AuthorQuery = htmlDB.Articles.Author >= request.args(0)*
* List = htmlDB(AuthorQuery).select(htmlDB.Articles.ALL,
orderby=~htmlDB.Articles.Dated)*
* else:*
* List = htmlDB().select( htmlDB.Articles.ALL,
orderby=~htmlDB.Articles.Dated, limitby=(0, 2) )*
* return dict(List=List)*
Is there any way to make it work like this on GAE:
*AuthorQuery = htmlDB.Articles.Author == request.args(0)*
*Thank you, very much, once again, even though we are still far from a
solution.*
— PV —
On Thursday, 23 June 2016 21:54:59 UTC-4, Anthony wrote:
>
> No, I was not recommending changing the field type to list:string -- that
> isn't the appropriate field type for your data. I was just mentioning that
> .contains only works on list fields, and in that case, it is looking for
> complete word matches within the list. The bottom line is that you cannot
> do this using the App Engine datastore -- that is one of its limitations.
> You could instead consider using the Search API
> <https://cloud.google.com/appengine/docs/python/search/>, but you'll need
> a way to get the data into the search indexes, and you won't be able to use
> the DAL for queries.
>
> *Note, if you want to simulate a .startswith query, I think you can do
> htmlDB.Articles.Author >= request.args(0).*
>
> Anthony
>
> On Thursday, June 23, 2016 at 9:32:12 PM UTC-4, PRACHI VAKHARIA wrote:
>>
>>
>>
>> NEW MODIFIED CODE — STILL DOES NOT FUNCTION
>>
>> The following function does not work on GAE – the lines in Red.
>>
>> *MODEL*
>>
>> *htmlDB.define_table('Articles',*
>> * Field('Title'),*
>> * Field('HtmlBody', 'text', label="Enter Full Article"),*
>> * Field('Abstract', 'text', label="Enter Abstract"),*
>> * Field('Author', 'list:string'),*
>> * format='%(Title)s'*
>> * )*
>>
>> *CONTROLLER FUNCTION*
>>
>>
>>
>>
>>
>>
>>
>>
>> *def HomeList(): if request.args(0): AuthorQuery =
>> htmlDB.Articles.Author.contains(request.args(0)) List =
>> htmlDB(AuthorQuery).select(htmlDB.Articles.ALL,
>> orderby=~htmlDB.Articles.Dated) else: List = htmlDB().select(
>> htmlDB.Articles.ALL, orderby=~htmlDB.Articles.Dated, limitby=(0, 2) )
>> return dict(List=List)*
>>
>>
>>
>> For a URL like this
>> *http://........../HomeList.html/AUTHOR NAME*
>> The controller much check if the 'AUTHOR NAME' is in the
>>
>> *htmlDB.Articles*
>> *What should I do or change to make the above work? Can anyone post the
>> change in code or Field type required?*
>>
>> Thank you, again!
>>
>>
>> — PRACHI —
>>
>>
>>
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.