Hi,
I am using Box Java SDK to search files from box. I need to search and display "Tags" of the files with the search result.
I tried to add the "tags" field in BoxSearchParameters as explained in the documentation, but this is returning null in the resultset, however other fields are populated with data. (File is having tags)
Code is something like the following:
BoxAPIConnection api = BoxAuthenticationUtil.initiateBoxAPIConnection();
BoxSearch boxSearch = null;
if(Validator.isNotNull(api)){
boxSearch = new BoxSearch(api);
}
BoxSearchParameters bsp = new BoxSearchParameters();
bsp.setQuery("searchquery");
List fields = new ArrayList();
fields.add("name");
fields.add("shared_link");
fields.add("tags");
bsp.setFields(fields);
PartialCollection searchResults = null;
searchResults = boxSearch.searchRange(0, 10, bsp);
try {
for (BoxItem.Info currentItemBox : searchResults) {
log.info("Name: " + currentItemBox.getName()); // printing name
log.info("Name: " + currentItemBox.getSharedLink().getURL()()); // printing URL
log.info("Name: " + currentItemBox.getTags()); // printing null
}
} catch (Exception e) {
_log.error("Error while getting Box Results" + e.getLocalizedMessage());
if (_log.isDebugEnabled()) {
_log.debug(e, e);
}
}