Goranek
Goranek

Reputation: 896

Multiple field names in appengine search

Is it possible to have multiple fields with same name in Appengine Search service?

Why would i need this? An example if the document is a newspaper page and it consists of single news, I would create fields story, title, author. It would work great and i would be able to query documents with title:"something", author:"something else", but what when you have multiple stories on the same page? Multiple titles?

If i create fields with names "title1", "title2" .. i'm unable to search with the query title:"something"

If i put all titles in the same "title", when i search title, i'll get mixed results

If this is a stupid idea, or if this isn't possible, can someone recommend a better way to solve this?

Upvotes: 2

Views: 105

Answers (1)

Faisal
Faisal

Reputation: 2276

Add another field that groups the stories.

basically you would be creating a search document per story like:

title, author, news_id
hi   ,    max,       1
hello,    max,       1
world,     me,       1
sup  ,     me,       2

then you query when you are in news page 1 with hi hello world stories and want author max. query: author: max and news_id: 1 query for title: title: hello

so you need to break your search documents more to do what you want.

Upvotes: 1

Related Questions