Full-text search API of Google App Engine

Source: Internet
Author: User
Tags web hosting
Search is a feature widely required by Google App Engine. in fact, the latest Gae SDK already provides search APIs, probably because they are not yet mature and have not yet been made public. however, some traces can be found in the Gae document.

The example in the official Google App Engine documentation uploading data with bulk data Uploader demonstrates how to add the search function:
First, set entity to searchable:
Def handleentity (self, entity ):
Ent = search. searchableentity (entity)
Return ent

Next, you can search the entity:
Query = search. searchablequery ('person ')
Query. Search (keyword)
For result in query. Run ():
Self. response. Out. Write ('% s' % result ['email'])

As you can see,CodeGoogle. appengine. ext. search. the downloaded SDK has the Gae source code. We can take the code to check whether: C: \ Program Files \ google \ google_appengine \ google \ appengine \ ext \ Search \ __init __. PY (this is the path on my machine, and the path you install may be different)
\ Search \__ init _. py has three classes:
Searchableentity
Searchablequery
Searchablemodel

Searchablemodel is a subclass of DB. model. To use searchablemodel, your model must be inherited from searchablemodel, rather than DB. model. You can use the query method to search:
Query = article. All (). Search ("sausages cheese dogs ")
App Engine guy explains how to use searchablemodel in the blog

The current search API is still very simple. It only supports exact matching, no phrases, no syntax changes, and does not support adding stop words by yourself. google should gradually enhance this function in the next releases. After all, search is Google's strength and it cannot be imagined that gogole's web hosting platform does not support search. let's wait and see.

My Google App Engine essays:
Full-text search API of Google App Engine
Restrictions on databases (datastore) in Google App Engine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.