I have made a google app using next db module (ndb) to create my models. Now the problem is i want to deploy search over the fields of these models, and i have found two modules to do that: 1. The officially shipped with google app engine (appengine/google/ext/search) and 2. gae text search (http://code.google.com/p/gae-text-search/). Both of these provide the Searchable Model for the old db module properties. Is there any way i can do full text search using ndb and google app engine 1.6.2. Also i want to store those search queries to the datastore, how can i achieve that too? I am using python 2.7 for my development. Thanks in advance.
3 Answers
1
votes
0
votes
0
votes
From: https://cloud.google.com/appengine/docs/python/search/
The Search API provides a model for indexing documents that contain structured data. You can search an index, and organize and present search results. The API supports full text matching on string fields. Documents and indexes are saved in a separate persistent store optimized for search operations. The Search API can index any number of documents.
Performing a search:
index.search("rose water")
Indexing an object:
from datetime import datetime
from google.appengine.api import search
my_document = search.Document(
fields=[
search.TextField(name='customer', value='Joe Jackson'),
search.HtmlField(name='comment', value='this is <em>marked up</em> text'),
search.NumberField(name='number_of_visits', value=7),
search.DateField(name='last_visit', value=datetime.now()),
search.DateField(name='birthday', value=datetime(year=1960, month=6, day=19)),
search.GeoField(name='home_location', value=search.GeoPoint(37.619, -122.37))
])