私はGoogleAppEngineを使用しているため、BigTableを使用しています。
私はperson
次のようなエンティティを持っています:
{
// This property would be encoded into JSON and saved un-indexed as db.Text()
phone_numbers:
{
'hHklams8akjJkaJSL': // <-- Should I key this object?
{
number:'555-555-5555',
type:'mobile',
},
etc...
},
// This property is an array of strings.
// It is searchable so that a query could be run to find all
// people with a particular phone number:
// "SELECT * FROM person WHERE phone_number_search_property =
// '5555555555'"
phone_number_search_property:['5555555555','other phone numbers...'],
first_name:'...',
etc...
}
プロパティは、phone_number
JSON形式(db.Text)のインデックス付けされていないテキストのblobとして保存されます。この状況で特定の電話番号を参照したい場合は、jsonをデコードしてから、探している特定のキーの電話番号を取得します。
はphone_number_search_property
検索に使用されます。電話番号による検索が可能になります。"SELECT * FROM person WHERE phone_number_search_property = '5555555555'"
この状況でエンティティ内の電話番号を参照するための良い方法は何ですか?ここでは、UUIDを使用して各値にキーを設定しています。これは「通常の」受け入れられた方法ですか?そうでない場合は、何ですか?
ありがとう!