indexJson.c 1.5 KB
Newer Older
dengyihao's avatar
dengyihao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free
 * Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#include "index.h"
dengyihao's avatar
dengyihao 已提交
16
#include "indexInt.h"
dengyihao's avatar
dengyihao 已提交
17 18 19

int tIndexJsonOpen(SIndexJsonOpts *opts, const char *path, SIndexJson **index) {
  // handle
dengyihao's avatar
dengyihao 已提交
20
  return indexOpen(opts, path, index);
dengyihao's avatar
dengyihao 已提交
21 22 23 24 25 26 27 28 29 30
}
int tIndexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) {
  for (int i = 0; i < taosArrayGetSize(terms); i++) {
    SIndexJsonTerm *p = taosArrayGetP(terms, i);
    INDEX_TYPE_ADD_EXTERN_TYPE(p->colType, TSDB_DATA_TYPE_JSON);
  }
  return indexPut(index, terms, uid);
  // handle put
}

dengyihao's avatar
dengyihao 已提交
31 32
int tIndexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *result) {
  SArray *terms = tq->query;
dengyihao's avatar
dengyihao 已提交
33 34 35 36
  for (int i = 0; i < taosArrayGetSize(terms); i++) {
    SIndexJsonTerm *p = taosArrayGetP(terms, i);
    INDEX_TYPE_ADD_EXTERN_TYPE(p->colType, TSDB_DATA_TYPE_JSON);
  }
dengyihao's avatar
dengyihao 已提交
37
  return indexSearch(index, tq, result);
dengyihao's avatar
dengyihao 已提交
38 39 40
  // handle search
}

dengyihao's avatar
dengyihao 已提交
41 42
void tIndexJsonClose(SIndexJson *index) {
  return indexClose(index);
dengyihao's avatar
dengyihao 已提交
43 44
  // handle close
}