I have a datastore model that looks like:
class Project(ndb.Model):
name = ndb.StringProperty()
statement = ndb.StringProperty()
description = ndb.StringProperty()
We are building out a Search API implementation from our model data... so I will be building Search API Documents and mapping our datastore models to them.
The end result is that I want to search all three of these fields from a single query... so for example, user types "city" and the system should find all Projects that have the word "city" in either name, statement, or description
I could define the Document with three fields that generally map 1-to-1 with the model such as:
fields = [
TextField(name="name" value=proj.value),
TextField(name="statement" value=proj.statement)
HtmlField(name="description" value=proj.description)
]
and then query with
"name:city OR statement:city OR description:city"
of course Search API documentation says:
The "OR" disjunction is an expensive operation in both billable operations and computation time
So my other option could be to combine these into a single searchable fieldname like:
fields = [
TextField(name="search" value=proj.value),
TextField(name="search" value=proj.statement)
HtmlField(name="search" value=proj.description)
]
and query with:
"search:city"
Should I assume the latter would perform better? But that approach would lose the distinction in field names, and possibly lose future benefits of "custom scoring" that the GAE team may add (see this question/answer):
Am I just trying to over-optimize too early and overthink everything? What say ye?