Exemple #1
0
static void run_line(const char *p, const char *end, const Corpus &corp)
{
    while(p < end)
    {
        while(p < end && *p == ' ') p++;
        const char *start = p;
        while(p < end && *p != ' ') p++;

        if(p - start > 0)
        {
            int term_id = corp.lookup(start, p-start);
            if(term_id == -1) 
                fprintf(stderr, "WARNING: term not found: '%.*s'\n", (int)(p-start), start);
            else {
                uint64_t x = rawpost(term_id, doc_id, term_pos++);
                fwrite_unlocked(&x, sizeof(x), 1, stdout);
            }
        }
    }
}