The following code may help, or you could extends your own class from
SearchableModel.


class SearchableModel2(db.Model):

  class Query(db.Query):
    """A subclass of db.Query that supports full text search."""

    def __int__(self, model_class, key_only):
          is_key_only = key_only
          super(Query, self).__int__(self, model_class, is_key_only)

    _search_query = None

    def search(self, search_query):
      """Adds a full text search to this query.

      Args:
        search_query, a string containing the full text search query.

      Returns:
        self
      """
      self._search_query = search_query
      return self

    def _get_query(self):
      """Wraps db.Query._get_query() and injects SearchableQuery."""
      query = db.Query._get_query(self,
                                  _query_class=SearchableQuery,
 
_multi_query_class=SearchableMultiQuery)
      if self._search_query:
        query.Search(self._search_query)
      return query

  def _populate_internal_entity(self):
    """Wraps db.Model._populate_internal_entity() and injects
    SearchableEntity."""
    return db.Model._populate_internal_entity(self,
 
_entity_class=SearchableEntity)

  @classmethod
  def from_entity(cls, entity):
    """Wraps db.Model.from_entity() and injects SearchableEntity."""
    if not isinstance(entity, SearchableEntity):
      entity = SearchableEntity(entity)
    return super(SearchableModel2, cls).from_entity(entity)

  @classmethod
  def all(cls,key_only):
    """Returns a SearchableModel2.Query for this kind."""
    return SearchableModel2.Query(cls, SearchableModel2, key_only)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to