McAbra
McAbra

Reputation: 2534

GAE query filters one model field but not another

please help me on this one because I'm really starting to hate GAE. I am new to it and have to bite code after someone else. I have a model like:

from google.appengine.api import search

class Recipe(someModelClass):
    title = db.StringProperty()
    title_normalized = db.StringProperty()

Now when i run:

search.Index(name='GLOBAL_RECIPES').search(query=search.Query("title: pâte"))

I get a recipe for "pâte" (what ever it is - some french food :) ) But for the example "pâte" is normalized to "pate" and i want to query over title_normalized:

search.Index(name='GLOBAL_RECIPES').search(query=search.Query("title_normalized: pate"))

It returns nothing.
I'm 100% sure i have the "pâte - pate" object in my database.
My index.yaml file have no entries that would contain kind: recipe and name: title or name: title_normalized.
If it helps unitTests have the same query results.
Is there a place for defining fields that should be indexed?

Upvotes: 0

Views: 36

Answers (1)

Peter Knego
Peter Knego

Reputation: 80350

You seem to be mixing two services here: Datastore and Search API.

The model you define is a Datastore NDB model, the query you perform is a Search API query.

Upvotes: 2

Related Questions