[Xapian-discuss] Query::MatchAll

Allen daineng at gmail.com
Mon Oct 6 12:21:24 BST 2008


I'm using debian, please compile with :

g++ quickstartindex.cpp `xapian-config --libs --cxxflags` -o quickstartindex
g++ quickstartsearch.cpp `xapian-config --libs --cxxflags` -o
quickstartsearch
g++ quickstartsearchall.cpp `xapian-config --libs --cxxflags` -o
quickstartsearchall

Source of quickstartindex.cpp :

#include <xapian.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    if (argc < 4) {
        cout << "usage: " << argv[0] << "<path to database>" <<
            " <document data> <document terms>" << endl;
        return EXIT_FAILURE;
    }

    try {
        Xapian::WritableDatabase database(argv[1],
Xapian::DB_CREATE_OR_OPEN);
        Xapian::Document newdocument;
        newdocument.set_data(string(argv[2]));
        for (int i(3); i < argc; ++i) {
            newdocument.add_posting(argv[i], i-2);
        }
        database.add_document(newdocument);
    }
    catch (const Xapian::Error &e) {
        cout << "Xapian.Error: " << e.get_msg() << endl;
    }

    return EXIT_SUCCESS;
}

sorry for troubling you.

2008/10/6 Olly Betts <olly at survex.com>

> On Mon, Oct 06, 2008 at 06:50:46PM +0800, Allen wrote:
> > int main(int argc, char *argv[])
> > [...]
>
> Sigh.  We're getting closer.  But that's not the *complete compilable*
> example I'm after - it's missing all the "#include" directives, and
> perhaps other required stuff.
>
> What I'm after is something I can compile and then run to recreate this
> problem.  Then I can poke it with debugging tools to work out what's
> going on.  And if your example works for me, I can be sure that it's not
> because we're using different code so we can move on to looking how our
> environments differ.  I'm *NOT* just after some code to read.
>
> It would actually be simpler for you to attach the full source file than
> trim it down.  And it would save me the tedious job of having to
> recreate all the lines you carefully chopped out.
>
> Cheers,
>     Olly
>


More information about the Xapian-discuss mailing list