Cloudant에 처음 익숙하지만 얼마 동안 DB2에서 SQL로 개발했습니다. Lucene 쿼리 엔진과 Cloudant 인덱스를 사용하여 쿼리에서 결과를 반환한다고 생각하지만 3 개의 예상 필드 중 2 개만 데이터를 반환한다는 문제가 있습니다. 데이터를 반환하지 않는 필드는 배열입니다. 우리의 애플리케이션은 Java를 실행하고 IBM의 Bluemix 및 WebSphere Liberty Profile을 사용하여 실행됩니다. cloudant-client-2.8.0.jar 및 cloudant-HTTP-2.8.0.jar 파일을 패키지화하여 클라우드 데이터베이스에 액세스했습니다. 우리는 많은 쿼리를 사용하므로 연결 자체가 정상입니다. 여기 Cloudant Client Search API를 사용하면 모든 결과가 반환되지 않음
....
Search searchSaaSData = ServiceManagerSingleton.getInstance().getSaaSCapabilitiesDatabase().search("versioning-ddoc/versioning-indx").includeDocs(true);
SearchResult<DocTypeInfo> result = searchSaaSData.querySearchResult(this.getJsonSelector(deliverableId), DocTypeInfo.class);
....
가 this.getJsonSelector 코드 : 여기
는 Cloudant API에 액세스 내 코드입니다
private String getVersioningSearch(String deliverableId) {
String query = "";
if (deliverableId != null && !deliverableId.isEmpty()) {
// Search based on deliverableId
query += "(";
query += "deliverableId:\"" + deliverableId + "\"" + ")";
}
logger.log(Level.INFO, "Search query is: " + query);
// The query is simple, will look like this:
// deliverableId:"0B439290AB5011E6BE74C84817AAB206")
return query;
}
를 내가 자바를 사용하고 위에 당신은 자바 코드에서 볼 수 있듯이 DocTypeInfo.class 객체는 검색에서 반환 된 데이터를 보유합니다.
public class DocTypeInfo {
private final String docType;
private final String version;
private String isPublishedForReports;
public DocTypeInfo(String docType, String version) {
this.docType = docType;
this.version = version;
}
/**
* @return the docType
*/
private String getDocType() {
return docType;
}
/**
* @return the version
*/
private String getVersion() {
return version;
}
/**
* @return the isPublishedForReports
*/
public String getIsPublishedForReports() {
return isPublishedForReports;
}
/**
* @param isPublishedForReports the isPublishedForReports to set
*/
public void setIsPublishedForReports(String isPublishedForReports) {
this.isPublishedForReports = isPublishedForReports;
}
}
내가 설정을 다음과 같이 Cloudant 대시 보드를 사용하여 설계 문서 및 인덱스가 있습니다 : 나는 실행하면
{
"_id": "_design/versioning-ddoc",
"_rev": "22-0e0c0ccfc2b5fe7245352da7e5b1ebd3",
"views": {},
"language": "javascript",
"indexes": {
"versioning-indx": {
"analyzer": {
"name": "perfield",
"default": "standard",
"fields": {
"deliverableId": "whitespace",
"docType": "standard",
"version": "standard",
"isPublishedForReports": "keyword"
}
},
"index": "function (doc) {
index(\"deliverableId\", doc.deliverableId, {\"store\":true, \"boost\":1.0});
index(\"docType\", doc.docType, {\"store\":true, \"boost\":1.0});
index(\"version\", doc.version, {\"store\":true, \"boost\":1.0});
if (Array.isArray(doc.publishSettings)) {
for (var i in doc.publishSettings) {
if (doc.publishSettings[i].options) {
for (var j in doc.publishSettings[i].options) {
index(\"isPublishedForReports\", doc.publishSettings[i].options[j].optionId, {\"store\":true, \"boost\":1.0});
}
}
}
}
}"
}
}
}
하여 문서 타입 및 버전 필드가 채워집니다 검색을, 그러나 isPublishedForReports 여기에 클래스입니다 필드는 항상 null이거나 반환하지 않습니다. CloudPad 대시 보드에서 isPublishedForReports 값이 반환되는 것을 볼 수있는 인덱스에 대해 쿼리를 실행할 때 개체에 채워지지 않은 이유를 알 수 없습니까? 어쩌면 나는 이것이 어떻게 만들어 지는지 오해하고있는 것일까? 여기
제가 DB를 조회하고 내가 원하는 결과를 볼 수있는 스크린 샷 :
이 도와주세요! -Doug
귀하와 귀하의 권리를 답변으로 표시했습니다. 내가 그것을 변경하고 필드에 액세스하기 시작하면 내가 원하는 것을 얻을 수 있습니다. 감사합니다. 매우 감사. -Doug M. – Doug