~ubuntu-branches/ubuntu/trusty/ruby-ferret/trusty

« back to all changes in this revision

Viewing changes to ext/document.h

  • Committer: Bazaar Package Importer
  • Author(s): Antonio Terceiro
  • Date: 2011-07-28 00:02:49 UTC
  • Revision ID: james.westby@ubuntu.com-20110728000249-v0443y69ftcpxwi6
Tags: upstream-0.11.6
ImportĀ upstreamĀ versionĀ 0.11.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef FRT_DOCUMENT_H
 
2
#define FRT_DOCUMENT_H
 
3
 
 
4
#include "global.h"
 
5
#include "hash.h"
 
6
 
 
7
/****************************************************************************
 
8
 *
 
9
 * DocField
 
10
 *
 
11
 ****************************************************************************/
 
12
 
 
13
#define DF_INIT_CAPA 1
 
14
typedef struct DocField
 
15
{
 
16
    char *name;
 
17
    int size;
 
18
    int capa;
 
19
    int *lengths;
 
20
    char **data;
 
21
    float boost;
 
22
    bool destroy_data : 1;
 
23
} DocField;
 
24
 
 
25
extern DocField *df_new(const char *name);
 
26
extern DocField *df_add_data(DocField *df, char *data);
 
27
extern DocField *df_add_data_len(DocField *df, char *data, int len);
 
28
extern void df_destroy(DocField *df);
 
29
extern char *df_to_s(DocField *df);
 
30
 
 
31
/****************************************************************************
 
32
 *
 
33
 * Document
 
34
 *
 
35
 ****************************************************************************/
 
36
 
 
37
#define DOC_INIT_CAPA 8
 
38
typedef struct Document
 
39
{
 
40
    HashTable *field_dict;
 
41
    int size;
 
42
    int capa;
 
43
    DocField **fields;
 
44
    float boost;
 
45
} Document;
 
46
 
 
47
extern Document *doc_new();
 
48
extern DocField *doc_add_field(Document *doc, DocField *df);
 
49
extern DocField *doc_get_field(Document *doc, const char *fname);
 
50
extern char *doc_to_s(Document *doc);
 
51
extern void doc_destroy(Document *doc);
 
52
 
 
53
#endif