Hi,

There is no difference.  In addition to the index for paging, you just have
a tag property.  So

# or SearchableModel
class MyProperty(db.Model):
  # For paging
  index = db.IntegerProperty()
  my_tags = db.StringListProperty()

For the first page, you do a fetch like this:
results = MyProperty.all().filter('my_tags =',
tag).order('-index').fetch(11)

if len(results) == 11:
  next_page = results[10].index

So the next page you would fetch /tag/my_tag?start=[next_page]

And the query for this would be:

results = MyProperty.all().filter('my_tags =', tag).filter('index <=',
next_page)order('-index').fetch(11)

if len(results) == 11:
  next_page = results[10].index

All adding tags does is introduce an additional property to filter on, along
with the index for paging.

-Marzia

On Tue, Dec 9, 2008 at 6:41 PM, kang <[EMAIL PROTECTED]> wrote:

> I've watched the video...my question is how to make paging index for tag
> and term for search?
>
>
> On Wed, Dec 10, 2008 at 1:25 AM, Marzia Niccolai <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> By index I mean whatever index you are using for pagination, an integer
>> property as described in the building scalable web applications talk:
>>
>> http://sites.google.com/site/io/building-scalable-web-applications-with-google-app-engine
>>
>> This should work to page searchable entities as well. Simply search for a
>> specific term, and then filter on the paging index.
>>
>> -Marzia
>>
>> On Mon, Dec 8, 2008 at 5:01 PM, kang <[EMAIL PROTECTED]> wrote:
>>
>>> I haven't got it...what is the 'index' for in your code? For different
>>> tags, they have different index for an object.
>>> 3rd question is about search the model.
>>>
>>> On Tue, Dec 9, 2008 at 4:03 AM, Marzia Niccolai <[EMAIL PROTECTED]>wrote:
>>>
>>>> Hi,
>>>>
>>>> If you store the tags in a list, you should be able filter on that list
>>>> using a simple equals filter, something like:
>>>>
>>>> MyProperty.all().filter('my tags =', tag).filter('index <=',
>>>> starting_index).fetch(10)
>>>>
>>>> Assuming you don't have a large number of tags (a couple per entry),
>>>> this shouldn't result in an exploding index.
>>>>
>>>> The third question, if I interpret it correctly, is about using the
>>>> Google Search AJAX API? If you want to use the search API for your site, 
>>>> and
>>>> page through the results on your site, it seems you can do pagination with
>>>> their API, the docs are available here:
>>>>
>>>> http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GSearch
>>>>
>>>> -Marzia
>>>>
>>>>
>>>> On Sun, Dec 7, 2008 at 6:51 PM, lookon <[EMAIL PROTECTED]> wrote:
>>>>
>>>>>
>>>>> I've got how to page to some extent..But I still have some problems
>>>>>
>>>>> 1.What's the best way to implement tag to a model
>>>>>
>>>>> 2.in this way, how to page the tag page?
>>>>>
>>>>> for example, http://a.appspot.com/tag/google, I need to show all model
>>>>> whose tag is google, and  I need to page it...
>>>>>
>>>>> 3.How to page the search result?
>>>>> If I search Google, I will get all the result, and I don't know how to
>>>>> page them.
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Stay hungry,Stay foolish.
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Stay hungry,Stay foolish.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to