Skip to content

allows to use excludeFromIndexes inside embedded Entities in datastore#741

Closed
martianoff wants to merge 1 commit intogoogleapis:masterfrom
martianoff:fix/embedded-entities-exclude-index
Closed

allows to use excludeFromIndexes inside embedded Entities in datastore#741
martianoff wants to merge 1 commit intogoogleapis:masterfrom
martianoff:fix/embedded-entities-exclude-index

Conversation

@martianoff
Copy link
Copy Markdown

helps to avoid errors like

The value of property stringValue is longer than 1500 bytes.

simple use following style for embedded entities to avoid error:

'entityValue' => [
    'properties' => [
        'name' => 'some_field',
        'value' => 'some_long_value',
        'excludeFromIndexes' => true,
    ]
]

@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Nov 15, 2017
@martianoff
Copy link
Copy Markdown
Author

I signed it!

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Nov 15, 2017
@martianoff martianoff changed the title allows to use excludeFromIndexes inside embedded Entities allows to use excludeFromIndexes inside embedded Entities in datastore Nov 15, 2017
@jdpedrie
Copy link
Copy Markdown
Contributor

jdpedrie commented Nov 15, 2017

I'm open to the value of what you are proposing, but your solution would prevent users from using excludeFromIndexes as a property name. Before we can merge this, we'll need to come up with a better solution.

@jdpedrie jdpedrie added api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Nov 15, 2017
@martianoff
Copy link
Copy Markdown
Author

martianoff commented Nov 17, 2017

@jdpedrie what if we will use following syntax?

'entityValue' => [
    'properties' => [
        'name' => 'some_field',
        'value' => 'some_long_value',
    ],
    'excludeFromIndexes' => ['name','value']
]

but it will need more changes
this issue is serious, currently we don't have any way to exclude fields from embedded entities

@jdpedrie
Copy link
Copy Markdown
Contributor

@maksimru what do you think about having Entity::setExcludeFromIndexes() accept a list of string|array?

Given this entity:

[
    'key' => 'val',
    'embeddedEntity' => [
        'foo' => 'val'
    ]
]

An exclude could work like this:

$entity->setExcludeFromIndexes([
    'key',
    ['embeddedEntity', 'foo']
]);

@martianoff
Copy link
Copy Markdown
Author

martianoff commented Nov 18, 2017

in that case i think more clear solution to use:

$entity->setExcludeFromIndexes([
    'key',
    'embeddedEntity.foo',
    'embeddedEntity.somearray[].foo',
    'embeddedEntity2.*',
    'somearray[].*'
]);

similar task in node sdk googleapis/google-cloud-node#2510 and googleapis/google-cloud-node#2615

@jdpedrie
Copy link
Copy Markdown
Contributor

@maksimru, I'm going to close this in favor of #754. Thank you for bring this issue to our attention! Please take a look at that other PR and give me your thoughts.

@jdpedrie jdpedrie closed this Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants