[Opentrep-svn] SF.net SVN: opentrep:[128] trunk/opentrep
Status: Beta
Brought to you by:
denis_arnaud
From: <den...@us...> - 2009-07-14 22:34:18
|
Revision: 128 http://opentrep.svn.sourceforge.net/opentrep/?rev=128&view=rev Author: denis_arnaud Date: 2009-07-14 22:34:14 +0000 (Tue, 14 Jul 2009) Log Message: ----------- [Test] Tested a few variations for Xapian string search. Modified Paths: -------------- trunk/opentrep/test/xapian/string_search.cpp Property Changed: ---------------- trunk/opentrep/ternary_tree/ Property changes on: trunk/opentrep/ternary_tree ___________________________________________________________________ Modified: svn:ignore - .libs .deps Makefile Makefile.in + .libs .deps Makefile Makefile.in simple_tst Modified: trunk/opentrep/test/xapian/string_search.cpp =================================================================== --- trunk/opentrep/test/xapian/string_search.cpp 2009-07-14 14:07:29 UTC (rev 127) +++ trunk/opentrep/test/xapian/string_search.cpp 2009-07-14 22:34:14 UTC (rev 128) @@ -28,20 +28,20 @@ for (int idx=2; idx != argc; ++idx) { if (idx != 2) { oStr << " "; -// oStr << " AND "; } const std::string lWord (argv[idx]); - const std::string lSuggestedWord = - db.get_spelling_suggestion (lWord, 3); + const std::string lSuggestedWord = db.get_spelling_suggestion(lWord, 3); std::cout << "Word `" << lWord << "' ==> Suggested word `" << lSuggestedWord << "'" << std::endl; oStr << lWord; } const std::string lQueryString = oStr.str(); + std::cout << "QueryString `" << lQueryString << "'" << std::endl; // Build the query object Xapian::QueryParser lQueryParser; lQueryParser.set_database (db); + lQueryParser.set_default_op (Xapian::Query::OP_NEAR); std::cout << "Query parser `" << lQueryParser.get_description() << "'" << std::endl; @@ -53,10 +53,11 @@ | Xapian::QueryParser::FLAG_LOVEHATE | Xapian::QueryParser::FLAG_SPELLING_CORRECTION); Xapian::Query lCorrectedQuery = lQueryParser.get_corrected_query_string(); - + std::cout << "Query `" << lQuery.get_description() << "', Corrected query `" << lCorrectedQuery.get_description() - << "'" << std::endl; + << "' " + << std::endl; // Give the query object to the enquire session enquire.set_query (lQuery); @@ -65,12 +66,19 @@ Xapian::MSet matches = enquire.get_mset (0, 10); // Display the results - int nbMatches = matches.size(); + const int nbMatches = matches.size(); std::cout << nbMatches << " results found" << std::endl; + + // if (true) { if (nbMatches == 0) { enquire.set_query (lCorrectedQuery); matches = enquire.get_mset (0, 10); + //const Xapian::MSet matchesAll = enquire.get_mset (); + if (matches.size() == matches.max_size()) { + std::cout << "Corrected string matches all the documents" + << std::endl; + } } const Xapian::Query& lActualQuery = enquire.get_query(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |