Mit freundlichen Grüßen
Hello again,
as i mentioned before i use swish-e c-library with the index files stored
on cd-rom.
I found out that this creates some different problems, because when
searching from cd-rom you have to avoid file access on all costs,
otherwise you will have a VERY slow performance.
Well, i am quite happy with the btree version here, because it helped me
to reduce search time from minutes to seconds. The problem is still the
missing "numerical" search, because the -L option is still quite slow.
However..
In my application i have to do a number of single searches (e.g.
name=smith, city=boston, -L age 20 35) which have to be combined to an
overall result in the end. I have to do it this way, because people want
to know how many entry with name=smith are in the database, how many
entries with city=boston are in the database etc.
Up to now i searched for name=smith. Then i searched for city=boston. Then
i searched for name="YYYY" -L age 20 35, and finally i searched for
name=smith and city=boston -L age 20 35 to get the combined end result.
Well as i am still trying to speed up things i thought it should be
possible to make the "andresultlists" function available in the c-library.
So i should be able to skip the final search for the end result and just
"and" the single results together.
Here's what i tried to achieve this:
RESULTS_OBJECT *SwishAndResults(RESULTS_OBJECT *results1, RESULTS_OBJECT
*results2)
{
DB_RESULTS *db_results;
DB_RESULTS *db_results2;
RESULT_LIST *new_list;
RESULT *cur_result;
db_results = results1->db_results;
db_results2 = results2->db_results;
//Doesn't work if this hasn't been done before calling andresultlists
db_results->resultlist = sortresultsbyfilenum(db_results->resultlist);
db_results2->resultlist = sortresultsbyfilenum(db_results2->resultlist);
db_results->resultlist =
andresultlists(db_results,db_results->resultlist,db_results2->resultlist,1
);
//After andresultlists totalresults has still the old value
//so i have to get the new number of results
/*
cur_result = db_results->resultlist->head;
//if i do this, it crashes when i try to access higher numbers in the
resultlist
while ( cur_result )
{
results1->total_results++;
cur_result = cur_result->next;
}
*/
//so i have to call sortresults again
results1->total_results = sortresults( results1 );
return results1;
}
I am not really happy with this solution, because it didn't have the
speedup effect i expected.
I think right now, this is because i have to sort the results threetimes.
Any suggestions anyone on
a) why i can't access the results when i fill total_results within the
while loop?
b) how to avoid the sorting before and after the call to andresultlists?
Best regards
Gunnar Mätzler
Received on Thu Feb 24 01:26:07 2005