diff -r c9188930a16f -r 38269b62d856 cos-search.cxx --- a/cos-search.cxx Sat Feb 12 13:48:14 2011 +0300 +++ b/cos-search.cxx Sat Feb 12 15:10:08 2011 +0300 @@ -51,11 +51,11 @@ pcrecpp::StringPiece input(qstring); // Wrap in a StringPiece string var; - while (prereg.Consume(&input, &var)) { - string upvar = var+"="; - std::transform(var.begin(), var.end(), var.begin(), ::tolower); + while (prereg.FindAndConsume(&input, &var)) { + string upvar = var+":"; + //std::transform(var.begin(), var.end(), var.begin(), ::tolower); std::transform(upvar.begin(), upvar.end(), upvar.begin(), ::toupper); - cout << var << upvar << endl; + //cout << var << " -> " << upvar << endl; qp.add_boolean_prefix(var,upvar); } @@ -63,7 +63,7 @@ // Build the query object Xapian::Query query = qp.parse_query(qstring); //Xapian::Query::OP_OR, argv + 2, argv + argc); - cout << "Performing query `" << query.get_description() << "'" << endl; + cerr << "Performing query `" << query.get_description() << "'" << endl; // Give the query object to the enquire session enquire.set_query(query); @@ -72,17 +72,16 @@ Xapian::MSet matches = enquire.get_mset(0, db.get_doccount()); // Display the results - cout << matches.size() << " results found" << endl; + cerr << matches.size() << " results found" << endl; for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i) { Xapian::Document doc = i.get_document(); - cout << "Document ID " << *i << "\t" << - i.get_percent() << "% [" << - doc.get_data() << "]" << endl; + cout << "#" << *i << "\t" << + doc.get_data() << endl; } } catch(const Xapian::Error &error) { - cout << "Exception: " << error.get_msg() << endl; + cerr << "Exception: " << error.get_msg() << endl; } }