index.c 1.9 KB
Newer Older
H
refact  
Hongze Cheng 已提交
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/>.
 */

dengyihao's avatar
dengyihao 已提交
16 17
#include "index.h"
#include "indexInt.h"
H
refact  
Hongze Cheng 已提交
18

dengyihao's avatar
dengyihao 已提交
19 20
#ifdef USE_LUCENE
#include "lucene++/Lucene_c.h"
H
refact  
Hongze Cheng 已提交
21 22
#endif

dengyihao's avatar
dengyihao 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35
static pthread_once_t isInit = PTHREAD_ONCE_INIT;

static void indexInit();

SIndex *indexOpen(SIndexOpts *opts, const char *path) {
  pthread_once(&isInit, indexInit);
#ifdef USE_LUCENE  
  index_t *index = index_open(path);      
  SIndex *p = malloc(sizeof(SIndex));
  p->index = index;
  return p;
#endif
  return NULL;
H
refact  
Hongze Cheng 已提交
36
}
dengyihao's avatar
dengyihao 已提交
37 38 39 40

void indexClose(SIndex *index) {
#ifdef USE_LUCENE  
  index_close(index->index); 
H
refact  
Hongze Cheng 已提交
41
#endif
dengyihao's avatar
dengyihao 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
  free(index);  
  return;

}
int indexPut(SIndex *index, SArray* field_vals, int uid) {
  return 1;

}
int indexSearch(SIndex *index,  SIndexTermQuery *query, SArray *result) {
  return 1;
}

int indexDelete(SIndex *index, SIndexTermQuery *query) {
  return 1;
}
int indexRebuild(SIndex *index, SIndexOpts *opts);

H
refact  
Hongze Cheng 已提交
59

dengyihao's avatar
dengyihao 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
SIndexOpts *indexOptsCreate() {
  return NULL;
}
void indexOptsDestroy(SIndexOpts *opts) {
  
}
/*
 * @param: oper 
 *
*/

SIndexTermQuery *indexTermQueryCreate(EIndexOperatorType oper) {
  return NULL;
}
void indexTermQueryDestroy(SIndexTermQuery *pQuery) {

}
int indexTermQueryAdd(SIndexTermQuery *pQuery, const char *field, int32_t nFields, const char *value, int32_t nValue, EIndexQueryType type){
  return 1;
}

void indexInit() {
  //do nothing
}