00001 /* 00002 * core.h version 1.0 00003 * Copyright (c) 2013 KAUST - InfoCloud Group (All Rights Reserved) 00004 * Authors: Amin Allam, Fuad Jamour 00005 * 00006 * Permission is hereby granted, free of charge, to any person 00007 * obtaining a copy of this software and associated documentation 00008 * files (the "Software"), to deal in the Software without 00009 * restriction, including without limitation the rights to use, 00010 * copy, modify, merge, publish, distribute, sublicense, and/or sell 00011 * copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following 00013 * conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be 00016 * included in all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00019 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 00020 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00021 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 00022 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 00023 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00024 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00025 * OTHER DEALINGS IN THE SOFTWARE. 00026 * 00027 * Current version: 1.1 (Feb 13, 2013) 00028 * 00029 * Version history: 00030 * - 1.1 (Feb 13, 2013) 00031 * * Fixed C incompatibility in enum definitions 00032 * - 1.0 (Feb 1, 2013) 00033 * * Initial release 00034 */ 00035 00036 #ifndef __SIGMOD_CORE_H_ 00037 #define __SIGMOD_CORE_H_ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00044 //********************************************************************************************* 00045 00049 #define MAX_DOC_LENGTH (1<<22) 00050 00053 #define MAX_WORD_LENGTH 31 00054 00058 #define MIN_WORD_LENGTH 4 00059 00063 #define MAX_QUERY_WORDS 5 00064 00068 #define MAX_QUERY_LENGTH ((MAX_WORD_LENGTH+1)*MAX_QUERY_WORDS) 00069 00070 00072 typedef unsigned int QueryID; 00073 00075 typedef unsigned int DocID; 00076 00077 00079 typedef enum{ 00083 MT_EXACT_MATCH, 00089 MT_HAMMING_DIST, 00095 MT_EDIT_DIST 00096 } 00097 MatchType; 00098 00100 typedef enum{ 00104 EC_SUCCESS, 00110 EC_NO_AVAIL_RES, 00115 EC_FAIL 00116 } 00117 ErrorCode; 00118 00120 //********************************************************************************************* 00121 00126 ErrorCode InitializeIndex(); 00127 00134 ErrorCode DestroyIndex(); 00135 00172 ErrorCode StartQuery(QueryID query_id, 00173 const char* query_str, 00174 MatchType match_type, 00175 unsigned int match_dist); 00176 00188 ErrorCode EndQuery(QueryID query_id); 00189 00211 ErrorCode MatchDocument(DocID doc_id, 00212 const char* doc_str); 00213 00243 ErrorCode GetNextAvailRes(DocID* p_doc_id, 00244 unsigned int* p_num_res, 00245 QueryID** p_query_ids); 00246 00248 //********************************************************************************************* 00249 00250 #ifdef __cplusplus 00251 } 00252 #endif 00253 00254 #endif // __SIGMOD_CORE_H_