[3745] | 1 | /**************************************************************************
|
---|
| 2 | *
|
---|
| 3 | * invf_get.h -- Inverted file reading routines
|
---|
| 4 | * Copyright (C) 1994 Neil Sharman
|
---|
| 5 | *
|
---|
| 6 | * This program is free software; you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU General Public License as published by
|
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | * (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * This program is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU General Public License
|
---|
| 17 | * along with this program; if not, write to the Free Software
|
---|
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 19 | *
|
---|
| 20 | * $Id: invf_get.h 23508 2010-12-17 01:04:10Z sjm84 $
|
---|
| 21 | *
|
---|
| 22 | **************************************************************************/
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | #ifndef H_INVF_GET
|
---|
| 26 | #define H_INVF_GET
|
---|
| 27 |
|
---|
| 28 | typedef struct Invf_Doc_Entry
|
---|
| 29 | {
|
---|
| 30 | int DocNum;
|
---|
| 31 | float Sum;
|
---|
| 32 | }
|
---|
| 33 | Invf_Doc_Entry;
|
---|
| 34 |
|
---|
| 35 | typedef struct Invf_Doc_Entry_Pool
|
---|
| 36 | {
|
---|
| 37 | void *pool;
|
---|
| 38 | unsigned pool_chunks;
|
---|
| 39 | }
|
---|
| 40 | Invf_Doc_Entry_Pool;
|
---|
| 41 |
|
---|
| 42 | typedef struct Invf_Doc_EntryH
|
---|
| 43 | {
|
---|
| 44 | Invf_Doc_Entry IDE;
|
---|
| 45 | struct Invf_Doc_EntryH *next;
|
---|
| 46 | }
|
---|
| 47 | Invf_Doc_EntryH;
|
---|
| 48 |
|
---|
| 49 | typedef struct Hash_Table
|
---|
| 50 | {
|
---|
| 51 | Invf_Doc_EntryH *Suplimentary_Entries;
|
---|
| 52 | int Suplimentary_Size;
|
---|
| 53 | int Suplimentary_Num;
|
---|
| 54 | unsigned max;
|
---|
| 55 | unsigned num;
|
---|
| 56 | unsigned size;
|
---|
| 57 | Invf_Doc_EntryH **HashTable;
|
---|
| 58 | Invf_Doc_EntryH *Head;
|
---|
| 59 | Invf_Doc_EntryH IDEH[1];
|
---|
| 60 | }
|
---|
| 61 | Hash_Table;
|
---|
| 62 |
|
---|
| 63 | typedef struct List_Table
|
---|
| 64 | {
|
---|
| 65 | unsigned max;
|
---|
| 66 | unsigned num;
|
---|
| 67 | Invf_Doc_Entry IDE[1];
|
---|
| 68 | }
|
---|
| 69 | List_Table;
|
---|
| 70 |
|
---|
| 71 | typedef enum
|
---|
| 72 | {
|
---|
| 73 | op_term, op_and_terms, op_and_or_terms, op_diff_terms
|
---|
| 74 | }
|
---|
| 75 | Op_types;
|
---|
| 76 |
|
---|
[23508] | 77 | /*Invf_Doc_Entry *HT_find(Hash_Table *HT, mg_u_long DN); */
|
---|
[3745] | 78 | void HT_free (query_data * qd, Hash_Table * HT);
|
---|
| 79 | void LT_free (query_data * qd, List_Table * LT);
|
---|
| 80 |
|
---|
| 81 | invf_data *InitInvfFile (File * InvfFile, stemmed_dict * sd);
|
---|
| 82 | void FreeInvfData (invf_data * id);
|
---|
| 83 |
|
---|
| 84 | DocList *GetDocs (query_data * qd, WordEntry * we, BooleanQueryInfo * bqi);
|
---|
| 85 |
|
---|
| 86 | float *CosineDecode (query_data * qd, TermList * Terms, RankedQueryInfo * rqi);
|
---|
| 87 |
|
---|
| 88 | void free_ide_pool (query_data * qd, Invf_Doc_Entry_Pool * pool);
|
---|
| 89 |
|
---|
| 90 | Splay_Tree *CosineDecodeSplay (query_data * qd, TermList * Terms,
|
---|
| 91 | RankedQueryInfo * rqi, Invf_Doc_Entry_Pool * pool);
|
---|
| 92 |
|
---|
| 93 | Hash_Table *CosineDecodeHash (query_data * qd, TermList * Terms,
|
---|
| 94 | RankedQueryInfo * rqi);
|
---|
| 95 | List_Table *CosineDecodeList (query_data * qd, TermList * Terms,
|
---|
| 96 | RankedQueryInfo * rqi);
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | DocList *GetDocsOp (query_data * qd, WordEntry * we, Op_types op, DocList * L);
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | #endif
|
---|