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を使用してもすべての結果が返されない場合
はCloudant APIにアクセスする私のコードです:私は、Javaを使用しています上記のJavaコードから見ることができるように
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;
}
:ここ
....
Search searchSaaSData = ServiceManagerSingleton.getInstance().getSaaSCapabilitiesDatabase().search("versioning-ddoc/versioning-indx").includeDocs(true);
SearchResult<DocTypeInfo> result = searchSaaSData.querySearchResult(this.getJsonSelector(deliverableId), DocTypeInfo.class);
....
はthis.getJsonSelectorコードです検索から返されたデータを保持する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});
}
}
}
}
}"
}
}
}
DOCTYPEとバージョンのフィールドが移入され、検索を、しかしisPublishedForReportsここでクラスがありますフィールドは常にnullです。返されません。 CloudPadのダッシュボードで、isPublishedForReportsの値が返されていることがわかるインデックスに対してクエリを実行すると、なぜオブジェクトに値が設定されていないのか分かりません。多分私はこれらがどのように構築されるのか誤解していますか?ここで
私はDBを照会し、私は私が望む結果を見ることができるスクリーンショット:
が助けてください! -Doug
あなたの権利と私は答えとしてあなたのマークを付けました。私はそれを変更し、フィールドにアクセスし始めたとき、私は必要なものを得ることができます。ウェルの説明に感謝します。とても有難い。 -Doug M. – Doug