From: Michael Z. (B. 7. LEXIN) <mzh...@bl...> - 2013-10-09 18:37:33
|
Hi Borek, Yes, it works. Thanks a lot. BTW, do I need delete Field to free the memory? Thanks a lot for your reply and help. wish you have a great day. Yours, Michael zhang ----- Original Message ----- From: ko...@to... To: MICHAEL ZHANG (BLOOMBERG/ 731 LEXIN), clu...@li... At: Oct 9 2013 14:34:05 You should pass dynamically allocated Field object, as you can see e.g. in TestIndexWriter code: doc.add ( *_CLNEW Field(_T("field0"),fld,Field::STORE_YES | Field::INDEX_TOKENIZED) ); Hope this helps Borek From: Michael Zhang (BLOOMBERG/ 731 LEXIN) [mailto:mzh...@bl...] Sent: Wednesday, October 09, 2013 4:38 PM To: clu...@li... Subject: [CLucene-dev] crash -- R6025 pure virtual function call I try to write a test application in Microsoft VS 2010 as following. and when I debug the code, it crash at: writer.addDocument(&doc); and I get an error message, it shows: Runtime Error! Program: C:... R6025 - pure virtual function call Anybody knows how to fix it? Thanks. ___________________________________________________________________ RAMDirectory directory; StandardAnalyzer analyzer; IndexWriter writer(&directory, &analyzer, true); lucene::document::Document doc; doc.add(lucene::document::Field(L"content", L"abcd", lucene::document::Field::STORE_YES| lucene::document::Field::INDEX_TOKENIZED, true)); writer.addDocument(&doc); writer.optimize(); writer.close(); |