crash with MakeSearch

Arthur Clemens aclemens at xs4all.nl
Sat Oct 25 21:57:36 CDT 2003


I have come across a bug (or is it a feature?) with MakeSearch, where I 
use the "=" operator with a search. Page 27 of VSDKReference.pdf says:

2) "[=] Value"
This expression specifies an exact match to some value. For 
String/VarChar fields, if the
sign "=" is absent then search returns all records which begins from 
specified string.
Example: "=Ann" returns records which exact match to "Ann",
"Ann" returns records records like "Ann", "Anndd", "Anngggg".

I found that I get good results when I don't use the "=" operator.
I also get good results when I use the "=" operator and there *is* and 
exact match in the database, but I get a crash when there is no exact 
match. In my test I have the words "mleko" and "mlin"; the crash occurs 
when searching with "=ml".

void runTestsearch() {
	// 3 words in database: "mlin", "mleko", "apno"
	cout << "test 1... " << endl;
	testsearchSloveneWord("ml"); // fine: 2 results
	cout << "test 2... " << endl;
	testsearchSloveneWord("=mlin"); // fine: 1 result
	cout << "test 3... " << endl;
	testsearchSloveneWord("=ml"); // crash
}
void testsearchSloveneWord(const char* inText) {
	VDK_SearchTree* searchTree = new VDK_SearchTree();
	VDK_OR_Branch* searchBranch = new VDK_OR_Branch();
	searchBranch->SetCondition( mSloveneWord->GetField("Slovene word 
text"), inText );
	searchTree->Add_OR_Branch(searchBranch);
	FBL_BitSet* resultsBitset = mSloveneWord->MakeSearch( searchTree );
	cout << "number of results found for " << inText << " = " << 
resultsBitset->GetCount() << endl;
}

(MacOS X, VSDK Framework)

Arthur


More information about the Valentina mailing list