SOQL 查询 url 个地址
SOQL querying url addresses
我正在努力以一种可以通过 API.
按 URL 地址搜索和过滤的方式获得正确的 SOQL 查询
我们有一个自定义字段 Crunchbase_URL__c
,它既可以由我的应用程序编写(使用 REST API),也可以由用户手动填写。
大多数时候,当 URL 被自动填充时,行
.../services/data/v47.0/query?q=SELECT Name FROM Account WHERE Crunchbase_URL__c = 'https://www.crunchbase.com/organization/{the permalink that I'm searching}'
可以正常工作,但有时当用户只键入 www.crunchbase.com/....
而没有 https
时,查询显然返回为空。
我尝试使用 LIKE
而不是 =
运算符,但它看起来只适用于以查询词开头的字符串。所以
SELECT Name FROM Account WHERE Crunchbase_URL__c LIKE '%crunchbase.com/....'
不工作。
目前我的解决方法是查询所有可能性(来自我的 Javascript 代码):
"Crunchbase_URL__c = 'https://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'https://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'http://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'http://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'www.crunchbase.com/organization/" + Sel_row.QueryName + "' "
但这看起来不像是正确的方法。
此外,在查询标准网站字段时,我遇到了完全相同的问题。
我也考虑过查询所有帐户,然后在 Google Apps 脚本(这是一个自定义插件)中进行过滤,但这似乎也不是最好的方法。
根据 documentation:
The % wildcard (in a WHERE ... LIKE ... clause) matches zero or more characters
您必须允许您要搜索的词后可能有字符。
例如,'%ell%'
匹配一条记录 'hello'。但是 '%ell'
没有。
您应该能够使用 '%://%cruchbase.com/%some-query-term%'
,其中一些查询词与字符串在 URL 中的显示方式完全匹配。
您能否举例说明 URL 以及您希望检索它但不起作用的查询?
我正在努力以一种可以通过 API.
按 URL 地址搜索和过滤的方式获得正确的 SOQL 查询我们有一个自定义字段 Crunchbase_URL__c
,它既可以由我的应用程序编写(使用 REST API),也可以由用户手动填写。
大多数时候,当 URL 被自动填充时,行
.../services/data/v47.0/query?q=SELECT Name FROM Account WHERE Crunchbase_URL__c = 'https://www.crunchbase.com/organization/{the permalink that I'm searching}'
可以正常工作,但有时当用户只键入 www.crunchbase.com/....
而没有 https
时,查询显然返回为空。
我尝试使用 LIKE
而不是 =
运算符,但它看起来只适用于以查询词开头的字符串。所以
SELECT Name FROM Account WHERE Crunchbase_URL__c LIKE '%crunchbase.com/....'
不工作。
目前我的解决方法是查询所有可能性(来自我的 Javascript 代码):
"Crunchbase_URL__c = 'https://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'https://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'http://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'http://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'crunchbase.com/organization/" + Sel_row.QueryName + "'" +
" OR Crunchbase_URL__c = 'www.crunchbase.com/organization/" + Sel_row.QueryName + "' "
但这看起来不像是正确的方法。
此外,在查询标准网站字段时,我遇到了完全相同的问题。
我也考虑过查询所有帐户,然后在 Google Apps 脚本(这是一个自定义插件)中进行过滤,但这似乎也不是最好的方法。
根据 documentation:
The % wildcard (in a WHERE ... LIKE ... clause) matches zero or more characters
您必须允许您要搜索的词后可能有字符。
例如,'%ell%'
匹配一条记录 'hello'。但是 '%ell'
没有。
您应该能够使用 '%://%cruchbase.com/%some-query-term%'
,其中一些查询词与字符串在 URL 中的显示方式完全匹配。
您能否举例说明 URL 以及您希望检索它但不起作用的查询?