Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add custom query conditions, such as memo in transfer #209

Closed
cppfuns opened this issue Jan 29, 2021 · 3 comments
Closed

How to add custom query conditions, such as memo in transfer #209

cppfuns opened this issue Jan 29, 2021 · 3 comments

Comments

@cppfuns
Copy link

cppfuns commented Jan 29, 2021

"server error: unable to initiate to search: The following fields you are trying to search are not currently indexed: 'data.memo'. Contact our support team for more."

@maoueh
Copy link
Contributor

maoueh commented Jan 29, 2021

The action's data fields that are indexed is defined the search-common-indexed-terms config which defaults to "receiver, account, action, auth, scheduled, status, notif, input, event, ram.consumed, ram.released, db.key, db.table, data.account, data.active, data.active_key, data.actor, data.amount, data.auth, data.authority, data.bid, data.bidder, data.canceler, data.creator, data.executer, data.from, data.is_active, data.is_priv, data.isproxy, data.issuer, data.level, data.location, data.maximum_supply, data.name, data.newname, data.owner, data.parent, data.payer, data.permission, data.producer, data.producer_key, data.proposal_name, data.proposal_hash, data.proposer, data.proxy, data.public_key, data.producers, data.quant, data.quantity, data.ram_payer, data.receiver, data.requested, data.requirement, data.symbol, data.threshold, data.to, data.transfer, data.voter, data.voter_name, data.weight, data.abi, data.code"

All fields that do not start with data. are "fixed", means that you can have them in the list to have them indexed or off to disable indexing for it but we cannot add new one (block_timestamp for example would be rejected).

All fields starting to data. are dynamic and can be anything, if they match an action's field name, it will be indexed, for example if you deploy a smart contract which have an action event_id and you have data.event_id in the list, you will be able to search by receiver:mycontract data.event_id:something.

Now about data.memo specifically, it can be added to the list, it will work, but it will be a full match, there is no tokenization on the memo data and no interpretation. The means that a memo of the form first second third, data.memo:first will not match, only data.memo:'first second third' will match the field.

@maoueh maoueh closed this as completed Jan 29, 2021
@cppfuns
Copy link
Author

cppfuns commented Jan 30, 2021

Thanks for the answer, in order to help friends who encounter this problem later, I have attached an explanation article, which will continue to be updated later

https://www.bcskill.com/index.php/archives/1009.html

@cppfuns
Copy link
Author

cppfuns commented Jan 30, 2021

Suppose I have a contract A, and I want to set query options for parameter B in a certain ACTION, then I need to add "data.B" to search-common-indexed-terms. At this time, many other people's contracts also have other ACTION with parameter B. Is it possible to query other people's contracts to execute the corresponding ACTION transaction? I just wanted to check my own contract, and it was a specified ACTION. Now all ACTIONs in the whole chain can be checked. Will dfuseeos store a lot of unnecessary index-like data? Affect overall performance?
@maoueh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants