[Xapian-discuss] Query::MatchAll

Allen daineng at gmail.com
Mon Oct 6 11:50:46 BST 2008


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

    try {
        Database db(argv[1]);
        Enquire enquire(db);
        enquire.set_query(Query::MatchAll);
        MSet matches = enquire.get_mset(0, 10);
        cout << matches.size() << " results found" << endl;
        for (MSetIterator i = matches.begin(); i != matches.end(); i++) {
            Document doc = i.get_document();
            cout << "#" << *i << "\t" << i.get_percent() << "% [" <<
                doc.get_data() << "]" << endl;
        }
    }
    catch (const Error &e) {
        cout << "Xapian.Error: " << e.get_msg() << endl;
    }

    return EXIT_SUCCESS;
}


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

> On Mon, Oct 06, 2008 at 06:35:08PM +0800, Allen wrote:
> > $ ./quickstartsearchall proverbs/
> > 2 results found
> > #1      100% [hello]
> > #2      84% [world]
>
> And the source code to quickstartsearchall is?
>
> Cheers,
>     Olly
>


More information about the Xapian-discuss mailing list