林德
2013-Mar-05 07:54 UTC
[Xapian-devel] Remote database & local database, and adding new weight found vtable error
Hello, guys. Q1. now I have load all the docid and its document data into a dictionary for faster loading data instead of calling Xapian::MSetIterator i; i.get_document().get_data(); but I was happened to discover that the dictionaries got by such two method were different: both methods use DB1, DB2 method 1: Xapian::Database db = Xapian::Database(the path of DB1); Xapian::Database db2 = Xapian::Database(the path of DB2); db.add_database(db2); I pre-load the docid and its document data into dictionary DT1; method 2: DB1 and DB2 are opened by Xapian-tcpsrv for remote access. Xapian::Database dbr = Xapian::Remote::open(host of DB1, port of DB1, 0, 0); Xapian::Database dbr2 = Xapian::Remote::open(host of DB2, port of DB2, 0, 0); db.add_database(dbr2); Here dictionary DT2 holds the docid and its document data. ============ Q2. I want add a weight scheme into Xapian-1.2.12; I have implemented it by add Myweight.cc in ./weight/ with weight.cc, etc. and I also added necessary declaration in ./include/xapian/weight.h for Myweight. by add Myweight.cc into ./weight/Makefile.am I have successfully compiled the source code and got the dynamic library. But when I call Myweight scheme in my own c++ program, the compiler told me that "undefined reference to 'vtable for Xapian::Myweight'". I have checked all the virtual function include the destructor and all of them were re-implemented in Myweight.cc. Then I replace all the code about TradWeight by Myweight; and unfortunately all works well by calling "TradWeight" which actually is implemented Myweight scheme. I know it maybe not the problem of Xapian but my lack of C++ skills. It would be nice for all your answers. -- Ronghua Lin College of Computer Science and Technology, Zhejiang University Hangzhou, China, 310027 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20130305/b0ee7d6e/attachment.html>
Olly Betts
2013-Mar-10 10:05 UTC
[Xapian-devel] Remote database & local database, and adding new weight found vtable error
On Tue, Mar 05, 2013 at 03:54:59PM +0800, ?????? wrote:> Xapian::Database dbr = Xapian::Remote::open(host of DB1, port of DB1, 0, 0); > Xapian::Database dbr2 = Xapian::Remote::open(host of DB2, port of DB2, 0, > 0); > > db.add_database(dbr2);Don't you mean: dbr.add_database(dbr2); If that's not the issue, I don't think I can tell what's up from the information you've given.> Q2. > I want add a weight scheme into Xapian-1.2.12; > I have implemented it by add Myweight.cc in ./weight/ with weight.cc, etc. > and I also added necessary declaration in ./include/xapian/weight.h for > Myweight. > > by add Myweight.cc into ./weight/Makefile.am I have successfully compiled > the source code and got the dynamic library. > > But when I call Myweight scheme in my own c++ program, the compiler told me > that "undefined reference to 'vtable for Xapian::Myweight'".That sounds like your new file isn't being included.> I have checked all the virtual function include the destructor and all of > them were re-implemented in Myweight.cc.Did you configure with --enable-maintainer-mode? If not, then the rules to regenerate the build system are disabled (some platforms have "make" programs which try to rebuild stuff when it's not appropriate). You aren't the first to be caught out by this, and we have discussed changing this so maintainer mode is on by default. Then we can advise people to configure with --disable-maintainer-mode or use GNU make if their platform's make causes problems. But we haven't made that change yet. Incidentally, in case you weren't aware, you don't have to include a new weighting scheme in the library in order to use it. Cheers, Olly