0

The Google App Engine has previously released a Search API, that allows you to create Document objects, which can be searched within an indexing system similar to Googles search operations.

One of the associated classes is the FieldExpression. According to the documentation, an expression allows you to define custom content snippets for your fields. The example that they have given for a FieldExpression definition is:

FieldExpression(name='content_snippet',
                expression='snippet("very important", content)')

...where the name parameter identifies the expression, and the expression parameter is some form of code, executed when the specific FieldExpression's value is accessed on a document.

My question is, can I call external methods on my Document object (or possibly else where), from within the expression code? If not, what are your syntax options for use when defining a FieldExpression object?

RLH
  • 15,230
  • 22
  • 98
  • 182

1 Answers1

1

You can't call your own external methods.
At the moment, the defined functions are 'snippet', 'max', 'min', and 'count'. (For example, max(3,price)). However, there are currently some known issues with some of these; e.g. 'count' will probably not work.

In future, the number of such supported functions will be increased. In addition to string operations, e.g. for concatenation and trimming, more mathematical functions will be supported.

Amy U.
  • 2,227
  • 11
  • 11
  • Thanks Amy! Do you work for the App Engine team (just curious.) I was hoping that someone from Google would clarify some of the questions a few of us have around here. If you are, great work! I've really enjoy the GAE product! – RLH May 17 '12 at 12:22
  • Yes, I do, and am a good contact for Search API-related questions. – Amy U. May 17 '12 at 20:48