1 | /**************************************************************************
|
---|
2 | *
|
---|
3 | * DocEntry.cpp -- Underlying routines for mgquery
|
---|
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: DocEntry.cpp 711 1999-10-17 23:43:31Z cs025 $
|
---|
21 | *
|
---|
22 | **************************************************************************/
|
---|
23 |
|
---|
24 | #include "sysfuncs.h"
|
---|
25 |
|
---|
26 | #include "memlib.h"
|
---|
27 | #include "netorder.h" /* [RPAP - Jan 97: Endian Ordering] */
|
---|
28 |
|
---|
29 | #include "DocEntry.h"
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Block: Query Document handling;
|
---|
33 | * Provides basic loading/unloading facilities for individual
|
---|
34 | * documents, usually for presentation purposes (searches
|
---|
35 | * are performed on inverted files
|
---|
36 | */
|
---|
37 |
|
---|
38 | long DocEntry_FreeTextBuffer(DocEntry *de)
|
---|
39 | {
|
---|
40 | if (de->CompTextBuffer)
|
---|
41 | {
|
---|
42 | delete de->CompTextBuffer;
|
---|
43 | de->CompTextBuffer = NULL;
|
---|
44 | return de->Len;
|
---|
45 | }
|
---|
46 | return 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 | /*
|
---|
50 | * Function: DE_comp
|
---|
51 | * Description: The void * parameters are deliberate; this function is used
|
---|
52 | * with the SP code, and the more abstract handle is required
|
---|
53 | */
|
---|
54 | int DocEntry_compare(void *a, void *b)
|
---|
55 | {
|
---|
56 | return ((DocEntry *) a)->SeekPos - ((DocEntry *) b)->SeekPos;
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|