2

我们在尝试使用 Cloudera Navigator API 检索包含空格的文件名的信息时遇到问题。我们可以通过将文件名括在引号中来在 Navigator UI 中搜索这些文件名。但是,到目前为止,我们一直无法弄清楚如何使用 API 来做到这一点。

我们已经尝试使用原始文件名:

http://navigator.url.com:7187/api/v9/entities/?query=parentPath :( /some/parent/path ) AND originalName:(Prov Layout-Others.txt)

我们尝试用“%20”替换空格:

http://navigator.url.com:7187/api/v9/entities/?query=parentPath :( /some/parent/path ) AND originalName:(Prov%20Layout-Others.txt)

我们尝试在 URL 中将文件名用引号括起来:

http://navigator.url.com:7187/api/v9/entities/?query=parentPath :( /some/parent/path ) AND originalName:("ProvLayout-Others.txt")

到目前为止,没有任何效果。有没有其他人遇到过这个问题,如果有,是否有解决方案?

谢谢。

4

2 回答 2

1

原来搜索带有空格的文件名的方法是在构建 REST API URL 时用星号 (*) 替换空格。

于 2018-02-02T18:18:11.153 回答
0

对于 v9 API,您可以使用 +(query1) +(query2) 或 %2B(query1)%20%2B(query2) 进行多个查询。

对于空格,您可以使用“%20”。如果您使用星号,它将在您的关键字之间获得任何字符(不仅仅是空格)。例如,“customer*ID”将返回“customer National ID”以及“customer ID”。

这适用于在描述中搜索“客户 ID”和在父路径中搜索 /default/*

url:7187/?query=%2B(description%3A"Customer%20ID")%20%2B(parentPath%3A%5C%2Fdefault%5C%2F*)&facets=%7B%7D
于 2018-05-07T06:26:35.743 回答