truezjz
2 years agoLevel 2
Not getting durl property using EV Search API
I was trying to follow EV Search API to use EV web service search, created proxy classes, the search run and return results, however it only return the default fields, even I set the return fields include durl, it not return the property.
This part of the test search code :
public String[] rfields = { "snum", "date", "auth", "subj", "durl" };
SearchRequest request = new SearchRequest();
request.setID(vaultid);
ArrayOfSource sources = new ArrayOfSource();
Source source1 = new Source();
source1.setArchiveID(vaultid);
sources.getSource().add(source1);
request.setSources(sources);
request.setBooleanTextQuery(keyword);
ResultOptions resultoption = new ResultOptions();
ArrayOfstring fields = new ArrayOfstring();
for (String rfield : rfields) {
fields.getString().add(rfield);
}
resultoption.setIncludeServerQuery(true);
// fields
JAXBElement<ArrayOfstring> resultfields = new ObjectFactory().createArrayOfstring(fields);
// resultfields.setValue(fields);
System.out.println("resultfields is " + resultfields.isNil() + " " + resultfields.isTypeSubstituted());
resultoption.setFields(resultfields);
if (format.equalsIgnoreCase("xml")) {
resultoption.setFormat(ResultsFormat.XML);
resultoption.setIncludeExtraInfo(true);
}
// System.out.println(resultoption.getFields().getValue().getString());
request.setResultOptions(resultoption);
QueryOptions QueryOptions = new QueryOptions();
QueryOptions.setAdministrativeSearch(true);
request.setQueryOptions(QueryOptions);
System.out.println(request.getResultOptions().getFields().getValue().getString());
SearchResponse searchresponse = searchService.search(request);
if (format.equalsIgnoreCase("xml")) {
System.out.println(searchresponse.getXMLResults().getValue());
} else {
System.out.println(searchresponse.getResults().getValue().getTotalMatches() + " hits "
+ searchresponse.getResults().getValue().getResultsCollection().getResult().size() + " results");
// Display each field/value pair for each result
for (Result result : searchresponse.getResults().getValue().getResultsCollection().getResult()) {
System.out.println("-----");
for (Field field : result.getFields().getField()) {
System.out.println(field.getName() + "=" + field.getValue() + "(" + field.getType() + ")");
}
}
}