Skip to main content.
home | support | download

Back to List Archive

when you get "err: no results" then you must know

From: Reino Va'inaste <reino(at)not-real.postimees.ee>
Date: Mon Apr 20 1998 - 13:00:32 GMT
Hi!

You must know that when you look for nonexixting word
in your index, then swish-e 
1) will make seek by first letter (e.g. m)
2) and then look words in _rest_of_index_ (words beginning with letters
m,n,o,p ...)

pls correct me, if I'm wrong, Reino

--------------------------------------------------------------------

getfileinfo() in search.c  will stop search only
when match occures or when reaching end of index

rp = NULL;

for (i = 0; (c = fgetc(fp)) != 0; ) {
    if (c == ':') {
         fileword[i] = '\0';
         i = 0;
         if (!strcmp(word, fileword))
                break;
         else {
	while ((c = fgetc(fp)) != 0)
	    ;
	if (offsets[STOPWORDPOS] == ftell(fp))
	   return NULL;  ------------->  out when reaching end
	continue;
         }
    }
    else
        fileword[i++] = c;
}
if (c == 0)
    return NULL;

--------------------------------

better solution is (?)

     int res;
...
     i = 0;
     if( !(res = strcmp(word, fileword)) )
                break;
     if( res < 0 )
                return NULL;
Reino Všinaste ( reino@postimees.ee ) ph (372) 7 390 379 
Postimees Gildi 1 Tartu Estonia     GSM 251 75186
-- "Contact" ---------------
- Do you think there are people on other planets?
- I don't know. But if it's just us, it would be an awful waste of space.
Received on Mon Apr 20 06:07:47 1998