File: generateInvertedFile.cc

package info (click to toggle)
gnuift 0.1.14%2Bds-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 5,632 kB
  • ctags: 2,973
  • sloc: cpp: 15,867; sh: 8,281; ansic: 1,812; perl: 1,007; php: 651; makefile: 483; lisp: 344
file content (96 lines) | stat: -rw-r--r-- 2,088 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/***************************************
*
* generateInvertedFile 
*
* creates an inverted file at the using the 
* files 
*
****************************************
*
* modification history:
*
* WM 991213 created the file
*
****************************************
*
* compiler defines used:
*
* QUERY
*
****************************************/

#include "libMRML/include/mrml_const.h"
#include "libMRML/include/CXMLElement.h"
#include "libGIFTAcInvertedFile/include/CAcIFFileSystem.h"

/***************************************
*
* main - main program, that reads the parameters and 
*        executes the creation of the inverted file 
*
****************************************
*
* modification history
*
* 
*
****************************************/

CMutex* gMutex(new CMutex());

main(int argc,
     char** argv){

  if(argc==2){
    /* reading the parameters */
    string lPrefix(argv[1]);
    string lURL2FTS(lPrefix+"/url2fts.xml");
    string lFeatureDescription(lPrefix+"/InvertedFileFeatureDescription.db");

    cout << "Creating an inverted file using the files"
	 << lPrefix << endl
	 << lURL2FTS << endl
	 << lFeatureDescription << endl
	 << endl
	 << flush;
    
    CXMLElement lElement(mrml_const::collection,
			 0);

    lElement.addAttribute(mrml_const::cui_base_dir,
			  lPrefix);			 
    lElement.addAttribute(mrml_const::cui_feature_file_location,
			  "url2fts.xml");
    lElement.addAttribute(mrml_const::cui_feature_description_location,
			  "InvertedFileFeatureDescription.db");
    lElement.addAttribute(mrml_const::cui_inverted_file_location,
			  "InvertedFile.db");
    lElement.addAttribute(mrml_const::cui_offset_file_location,
			  "InvertedFileOffset.db");
    lElement.addAttribute(mrml_const::cui_generate_inverted_file,
			  "yes");

    CAcIFFileSystem lAccessor(lElement);

    if(lAccessor){
      cout << "GENERATED inverted file" 
	   << endl
	   << flush;
      
    }else{
      cout << "ERROR in generating inverted file";
    }
  }else{
    
    cout << "USAGE: "
	 << argv[0] 
	 << " " 
	 << "[inverted file directory]";


  }
}