ellie,

Currently, I'm using the squat search engine which was copied from my old mail 
system.  Oddly enough, the squat syntax I was using in my cyrusd.conf, which 
used to work 2.5 no longer works for 3.4.2 which explains why the server-side 
searches aren't working for my new install.

Before I went to sleep last night I decided to try the Xapian search engine to 
see if that fixes anything.  I managed to rebuild Cyrus with Xapian support so 
I'll try it out today.

Oddly enough looking at the source code imapd/index.c I found this bit of code. 
 I only moonlight as a sysadmin and I'm actually a software developer and this 
looks pretty odd to me.

EXPORTED int index_search(struct index_state *state, 
                          struct searchargs *searchargs, 
                          int usinguid) 
{ 
    search_query_t *query = NULL; 
    search_folder_t *folder; 
    int nmsg = 0; 
    int i; 
    modseq_t highestmodseq = 0; 
    int r; 
 
    /* update the index */ 
    if (index_check(state, 0, 0)) 
        return 0; 
 
    highestmodseq = needs_modseq(searchargs, NULL); 
 
    query = search_query_new(state, searchargs); 
    r = search_query_run(query); 
    if (r) goto out;        /* search failed */ 
    folder = search_query_find_folder(query, index_mboxname(state)); 
 
    if (folder) { 
        if (!usinguid) 
            search_folder_use_msn(folder, state); 
        if (highestmodseq) 
            highestmodseq = search_folder_get_highest_modseq(folder); 
        nmsg = search_folder_get_count(folder); 
    } 
    else 
        nmsg = 0;
 
    if (searchargs->returnopts) { 
        begin_esearch_response(state, searchargs, usinguid, folder, nmsg); 
 
        if (nmsg) { 
            if (searchargs->returnopts & SEARCH_RETURN_ALL) { 
                struct seqset *seq = search_folder_get_seqset(folder); 
 
                if (seq->len) { 
                    char *str = seqset_cstring(seq); 
                    prot_printf(state->out, " ALL %s", str); 
                    free(str); 
                } 
 
                seqset_free(seq); 
            } 
            if (searchargs->returnopts & SEARCH_RETURN_RELEVANCY) { 
                prot_printf(state->out, " RELEVANCY ("); 
                for (i = 0; i < nmsg; i++) { 
                    if (i) prot_putc(' ', state->out); 
                    /* for now all messages have relevancy=100 */ 
                    prot_printf(state->out, "%u", 100); 
                } 
                prot_printf(state->out, ")"); 
            } 
 
            esearch_modseq_response(state, searchargs, folder, highestmodseq); 
        } 
    } 
    else { 
        prot_printf(state->out, "* SEARCH"); 

Basically, if searchargs->returnopts is non-zero actually do the search 
otherwise return "* SEARCH" telling the client that there were no search 
results.

If the switch over to Xapian search doesn't fix my issue my next move is to 
build this thing in debug mode set breakpoints and just step through this thing 
to see what is up with returnopts.  At the very least I can look at the call 
stack to determine what is setting returnopts and why I'm getting zero here.

Thanks,
Chris
------------------------------------------
Cyrus: Info
Permalink: 
https://cyrus.topicbox.com/groups/info/T378c22819927bdc7-Mc45dfeb76c9034116b011f79
Delivery options: https://cyrus.topicbox.com/groups/info/subscription

Reply via email to