Changeset 9218
- Timestamp:
- 2005-03-01T12:10:22+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/lucenesearch.cpp
r9210 r9218 37 37 38 38 #include "gsdlconf.h" 39 #include "gsdltools.h" 39 40 #include "lucenesearch.h" 40 41 #include "fileutil.h" … … 94 95 #endif 95 96 96 cerr << "**** in lu ecensearch" << endl;97 cerr << "**** in lucene search" << endl; 97 98 98 99 char *indexname = (filename_cat(collectdir, getindexsuffix(queryparams))).getcstr(); … … 119 120 120 121 text_t cmd = "lucene_query.pl "; 121 cmd += indexname + (text_t)" \"" + to_utf8(queryparams.querystring) + (text_t)"\"";122 cmd += (text_t)" \""+indexname + (text_t)"\" \"" + to_utf8(queryparams.querystring) + (text_t)"\""; 122 123 123 124 text_t xml_text = ""; … … 125 126 #ifdef __WIN32__ 126 127 //FILE *PIN = _popen(cmd.getcstr(), "r"); // didn't seem to work 127 128 cmd = (text_t)"bin\\windows\\perl\\bin\\perl.exe -S "+cmd;128 cmd = (text_t)"perl -S "+cmd; 129 // we write the result to a file 129 130 clock_t this_time = clock(); 130 131 text_t filename = "luc"; 131 132 filename.append(this_time); 132 133 filename.append(".txt"); 133 //cerr << "filename = "<<filename<<endl;134 134 135 text_t out_file = filename_cat(collectdir, filename); 135 cmd += (text_t)" > "+ out_file;136 //cerr << "cmd ="<<cmd<<endl;137 system(cmd.getcstr());138 139 read_file(out_file, xml_text);140 remove(out_file.getcstr()); // now delete it141 142 136 cmd += (text_t)" \""+out_file+ (text_t)"\""; 137 int rv = gsdl_system(cmd, true, cerr); 138 if (rv != 0) { 139 cerr << "tried to run command \""<<cmd<<"\", but it failed\n"; 140 } else { 141 read_file(out_file, xml_text); 142 remove(out_file.getcstr()); // now delete it 143 } 143 144 #else 144 145 FILE *PIN = popen(cmd.getcstr(), "r"); … … 150 151 return false; 151 152 } 152 153 154 153 while (!feof(PIN)) { 155 154 char buffer[256]; … … 160 159 #endif 161 160 expat_resultset(xml_text,queryresult); 162 161 163 162 #ifdef __WIN32__ 164 163 // _pclose(PIN); … … 168 167 169 168 return true; 170 169 } 171 170 /* 172 171 // use default query info settings - change to reflect user preferences?? … … 248 247 */ 249 248 250 return false;251 252 }253 254 249 255 250 bool lucenesearchclass::browse_search(const queryparamclass &queryparams,
Note:
See TracChangeset
for help on using the changeset viewer.