Marcel Overdijk
Marcel Overdijk

Reputation: 11467

Connecting AppEngine Datastore and Search API

I wonder what the best way is to connect the Datastore and the Search API.

What I'm looking for is whenever I create some entity (e.g. a product) that this product will be added to a search index. On update the index should be updated as well, and when deleting the product - you guess right - the product should be removed from search index.

When searching for a product I want to do a full-text search on the product index, but instead of the documents I need the real entities. Probably I will need to first search using the index, and then do a second call to the datastore?

What worries me most is keeping the datastore and search index in synch. And of course also going through the search index and the datastore will not only be cumbersome but I feel it might also give pains in terms of pagination.

I wonder if some people already have "connected" the datastore and search api this way and what the results have been, and maybe some best practices available. The appengine docs are not telling much is this area.

Upvotes: 11

Views: 703

Answers (1)

Thanos Makris
Thanos Makris

Reputation: 3115

In order to user the Search API, you need to define your searchable data into documents, and then structure them into an index by using the Index class. Thus, for the time being you need to do exactly what you describe, keep in sync the searchable documents with your datastore entities.

Upvotes: 1

Related Questions