Combining text search filters and queries in GAE

I am writing a GAE-based application that should allow users to filter items by several of their properties. Elements are stored as NDB objects. Some of the details can be matched by standard query filters, but some require the text search "full" (subscript) for everything that makes sense. In addition, reasonable ordering is required. This is best illustrated by the following contrived example:

class Product(ndb.Model) :
  manufacturer = ndb.StringProperty()
  model = ndb.StringProperty()
  rating = ndb.IntegerProperty(choices = [1, 2, 3, 4])
  features = ndb.StringProperty(repeated = True, choices = ['feature_1', 'feature_2'])
  is_very_expensive = ndb.BooleanProperty()
  categories = ndb.KeyProperty(kind = Category, repeated = True)

All product entities have the same ancestor as their "container." A product can belong to one or several categories, and the last - a tree.

Now users should be able to:

  • Narrow products by selecting a category (one is enough)
  • Filter them by specifying the minimum rating and desired features.
  • View extremely expensive products or those that are not (or view all)
  • Search for products by a fragment of text from the fields of the model and / or manufacturer
  • Assign a final list, for example. by model name (the ability to choose an order would be ideal, though).

All this at the same time, i.e. Filters and orders should be easily applied when search terms are provided.

Question: how to achieve such functionality using GAE?

There will be hundreds or perhaps millions of products in the database. The problem with the search API when used with NDB queries is filtering the search results and possibly organizing them.

Two solutions I was thinking about:

  • StringProperty Product, , (, , ) manufacturer model. , , . 40-50 "Product".

  • API , . . ( ) , . , , , , - 10 000 / . .

?

+4
1

GAE . , , , , , , , . , , - .

GAE :

  • , , - , NDB. , , , / . , , , .

  • GAE . . /. , , .

  • . Django non-rel , , . , Django, . , , , .

, . :

  • Google Compute Engine App Engine. , , , , Amazon . , , , GAE.

  • , ElasticSearch. , , - Google. ElasticSearch .

  • , push pull , . , "" . push pull , , . , .

  • , , . , "".

, URL-, , . , , , , . , , Google, .

+3

Source: https://habr.com/ru/post/1531939/


All Articles