1 |
adcroft |
1.1 |
/* |
2 |
|
|
$Id: txt.c,v 1.21 2001/11/25 14:16:37 whmoseley Exp $ |
3 |
|
|
** |
4 |
|
|
** |
5 |
|
|
** 2001-03-17 rasc save real_filename as title (instead full real_path) |
6 |
|
|
** was: compatibility issue to v 1.x.x |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
#include "swish.h" |
11 |
|
|
#include "txt.h" |
12 |
|
|
#include "mem.h" |
13 |
|
|
#include "string.h" |
14 |
|
|
#include "check.h" |
15 |
|
|
#include "merge.h" |
16 |
|
|
#include "docprop.h" |
17 |
|
|
#include "error.h" |
18 |
|
|
#include "compress.h" |
19 |
|
|
#include "file.h" |
20 |
|
|
#include "index.h" |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
/* Indexes all the words in a TXT file and adds the appropriate information |
24 |
|
|
** to the appropriate structures. This is the most simple function. |
25 |
|
|
** Just a call to indexstring |
26 |
|
|
*/ |
27 |
|
|
int countwords_TXT (SWISH *sw, FileProp *fprop, FileRec *fi, char *buffer) |
28 |
|
|
|
29 |
|
|
{ |
30 |
|
|
int metaID; |
31 |
|
|
int positionMeta; /* Position of word in file */ |
32 |
|
|
char *summary=NULL; |
33 |
|
|
char *title = ""; |
34 |
|
|
|
35 |
|
|
|
36 |
|
|
if(fprop->stordesc && fprop->stordesc->size) /* Let us take the summary */ |
37 |
|
|
{ |
38 |
|
|
/* No fields in a TXT doc. So it is easy to get summary */ |
39 |
|
|
summary=estrndup(buffer,fprop->stordesc->size); |
40 |
|
|
remove_newlines(summary); /* 2001-03-13 rasc */ |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
addCommonProperties( sw, fprop, fi, title, summary, 0 ); |
44 |
|
|
|
45 |
|
|
if(summary) efree(summary); |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
metaID=1; positionMeta=1; /* No metanames in TXT */ |
49 |
|
|
|
50 |
|
|
return indexstring(sw, buffer, fi->filenum, IN_FILE, 1, &metaID, &positionMeta); |
51 |
|
|
} |