Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Using SWISH-E with Mailman ... now with RSS feeds

From: Jordan Hayes <jmhayes(at)>
Date: Thu May 10 2007 - 20:51:07 GMT

Bill said:

> Will someone with a big index time the difference between those two?

I didn't see a response.  So:

% ./timeit
query(not somewordIknowisnotinmyindex) [hits=243756] took 00.381902 
query(not(a and not a)) [hits=243756] took 00.631291 seconds
% ./timeit
query(not somewordIknowisnotinmyindex) [hits=243756] took 00.309732 
query(not(a and not a)) [hits=243756] took 00.530991 seconds
% ./timeit
query(not somewordIknowisnotinmyindex) [hits=243756] took 00.233165 
query(not(a and not a)) [hits=243756] took 00.501219 seconds
% ./timeit
query(not somewordIknowisnotinmyindex) [hits=243756] took 00.247380 
query(not(a and not a)) [hits=243756] took 00.529831 seconds

#include <stdio.h>
#include <sys/time.h>
#include <swish-e.h>

static void _RunSearch(SW_HANDLE sh, char *q)
    struct timeval tv1, tv2, tv3;

    gettimeofday(&tv1, NULL);
    SW_SEARCH search = New_Search_Object(sh, "foo");
    SwishSetSort(search, "unixdate desc");
    SW_RESULTS sr = SwishExecute(search, q);
    int hits = SwishHits(sr);
    gettimeofday(&tv2, NULL);
    tv3.tv_sec = tv2.tv_sec - tv1.tv_sec;
    tv3.tv_usec = tv2.tv_usec - tv1.tv_usec;
    while (tv3.tv_usec < 0) {
        tv3.tv_usec += 1000000;
    printf("query(%s) [hits=%d] took %02d.%06d seconds\n",
      q, hits, tv3.tv_sec, tv3.tv_usec);

static char _indexes[] = "index.older index.ThisYear index.swish-e";

int main(int argc, char **argv)
    SW_HANDLE sh = SwishInit(_indexes);
    _RunSearch(sh, "not somewordIknowisnotinmyindex");
    _RunSearch(sh, "not(a and not a)");
    return 0;

Users mailing list
Received on Thu May 10 16:53:06 2007