|
67 | 67 | $scope.threadSortReverse = false;
|
68 | 68 | $scope.threadInfoLoading = false;
|
69 | 69 | $scope.hasIndexingError = false;
|
| 70 | + $scope.hasIndexingWarning = false; |
70 | 71 |
|
71 | 72 | $scope.indexStatus = null;
|
72 | 73 | function getIndexStatus() {
|
|
76 | 77 | }
|
77 | 78 | getIndexStatus();
|
78 | 79 |
|
79 |
| - function getRecordsWithIndexingErrors() { |
| 80 | + function getRecords(queryFilter) { |
80 | 81 | return $http.post("../api/search/records/_search?bucket=ie", {
|
81 |
| - query: { |
82 |
| - bool: { |
83 |
| - must: { terms: { indexingError: [true] } } |
84 |
| - } |
85 |
| - }, |
| 82 | + query: queryFilter, |
86 | 83 | from: 0,
|
87 | 84 | size: 0
|
88 | 85 | });
|
89 | 86 | }
|
90 |
| - getRecordsWithIndexingErrors().then(function (r) { |
| 87 | + |
| 88 | + /** |
| 89 | + * Get the metadata that have indexing errors (including warnings). |
| 90 | + * |
| 91 | + * @returns {*} |
| 92 | + */ |
| 93 | + function getRecordsWithIndexingErrors() { |
| 94 | + return getRecords({ |
| 95 | + bool: { |
| 96 | + must: { terms: { indexingError: [true] } } |
| 97 | + } |
| 98 | + }); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * Get the metadata that have indexing errors (excluding warnings) |
| 103 | + * |
| 104 | + * @returns {*} |
| 105 | + */ |
| 106 | + function getRecordsWithIndexingErrorsNoWarnings() { |
| 107 | + return getRecords({ |
| 108 | + bool: { |
| 109 | + must: [ |
| 110 | + { |
| 111 | + query_string: { |
| 112 | + query: "(-indexingErrorMsg.type:warning)", |
| 113 | + default_operator: "AND" |
| 114 | + } |
| 115 | + }, |
| 116 | + { terms: { indexingError: [true] } } |
| 117 | + ] |
| 118 | + } |
| 119 | + }); |
| 120 | + } |
| 121 | + |
| 122 | + getRecordsWithIndexingErrorsNoWarnings().then(function (r) { |
91 | 123 | $scope.hasIndexingError = r.data.hits.total.value > 0;
|
92 | 124 | });
|
93 | 125 |
|
| 126 | + /** |
| 127 | + * Get the metadata that have indexing warnings. |
| 128 | + * |
| 129 | + * @returns {*} |
| 130 | + */ |
| 131 | + function getRecordsWithIndexingWarnings() { |
| 132 | + return getRecords({ |
| 133 | + bool: { |
| 134 | + must: [ |
| 135 | + { |
| 136 | + query_string: { |
| 137 | + query: "(+indexingErrorMsg.type:warning)", |
| 138 | + default_operator: "AND" |
| 139 | + } |
| 140 | + }, |
| 141 | + { terms: { indexingError: [true] } } |
| 142 | + ] |
| 143 | + } |
| 144 | + }); |
| 145 | + } |
| 146 | + |
| 147 | + getRecordsWithIndexingWarnings().then(function (r) { |
| 148 | + $scope.hasIndexingWarning = r.data.hits.total.value > 0; |
| 149 | + }); |
| 150 | + |
94 | 151 | $scope.setThreadSortField = function (field) {
|
95 | 152 | if (field === $scope.threadSortField) {
|
96 | 153 | $scope.threadSortReverse = !$scope.threadSortReverse;
|
|
270 | 327 | configId: "recordsWithErrors",
|
271 | 328 | selectionBucket: "ies",
|
272 | 329 | defaultParams: {
|
273 |
| - "indexingErrorMsg.type": "warning", |
| 330 | + "indexingErrorMsg.type": ["warning", "error"], |
274 | 331 | sortBy: "changeDate",
|
275 | 332 | sortOrder: "desc"
|
276 | 333 | }
|
|
0 commit comments