366
catch (Xapian::QueryParserError e)
366
catch (Xapian::Error e)
368
g_debug ("Error parsing query '%s': %s", search_string, e.get_msg().c_str());
368
g_warning ("Error parsing query '%s': %s", search_string, e.get_msg().c_str());
369
369
return g_slice_new0 (UnityPackageSearchResult);
371
371
//cout << "Performing query `" << query.get_description() << "'" << endl;
383
383
searcher->enquire->set_sort_by_relevance ();
388
max_hits = (max_hits != 0 ? max_hits : searcher->db->get_doccount ());
389
searcher->enquire->set_query(query);
390
Xapian::MSet matches =
391
searcher->enquire->get_mset(0, max_hits);
393
// Retrieve the results, note that we build the result->results
394
// list in reverse order and then reverse it before we return it
395
387
result = g_slice_new0 (UnityPackageSearchResult);
396
result->num_hits = matches.get_matches_estimated ();
397
for (Xapian::MSetIterator i = matches.begin();
403
Xapian::Document doc = i.get_document();
404
UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
405
result->results = g_slist_prepend (result->results, pkginfo);
407
catch (Xapian::Error e)
409
g_warning ("Unable to read document from result set: %s",
410
e.get_msg().c_str());
414
result->results = g_slist_reverse (result->results);
391
max_hits = (max_hits != 0 ? max_hits : searcher->db->get_doccount ());
392
searcher->enquire->set_query(query);
393
Xapian::MSet matches =
394
searcher->enquire->get_mset(0, max_hits);
396
// Retrieve the results, note that we build the result->results
397
// list in reverse order and then reverse it before we return it
398
result->num_hits = matches.get_matches_estimated ();
399
for (Xapian::MSetIterator i = matches.begin();
405
Xapian::Document doc = i.get_document();
406
UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
407
result->results = g_slist_prepend (result->results, pkginfo);
409
catch (Xapian::Error e)
411
g_warning ("Unable to read document from result set: %s",
412
e.get_msg().c_str());
416
result->results = g_slist_reverse (result->results);
418
catch(const Xapian::Error e)
420
g_warning ("Error running query '%s': %s", search_string, e.get_msg().c_str());