Switch to unified view

a/src/rcldb/rclquery.cpp b/src/rcldb/rclquery.cpp
...
...
307
            m_db->m_ndb->db.reopen();
307
            m_db->m_ndb->db.reopen();
308
            m_nq->mset = m_nq->enquire->get_mset(first, qquantum);
308
            m_nq->mset = m_nq->enquire->get_mset(first, qquantum);
309
        } catch (const Xapian::Error & error) {
309
        } catch (const Xapian::Error & error) {
310
          LOGERR(("enquire->get_mset: exception: %s\n", 
310
          LOGERR(("enquire->get_mset: exception: %s\n", 
311
              error.get_msg().c_str()));
311
              error.get_msg().c_str()));
312
                  m_reason = error.get_msg();
312
                  return false;
313
                  return false;
313
        }
314
        }
314
315
315
        if (m_nq->mset.empty()) {
316
        if (m_nq->mset.empty()) {
316
            LOGDEB(("Query::getDoc: got empty mset\n"));
317
            LOGDEB(("Query::getDoc: got empty mset\n"));
...
...
347
                           0, m_nq->decider);
348
                           0, m_nq->decider);
348
349
349
    } catch (const Xapian::Error & error) {
350
    } catch (const Xapian::Error & error) {
350
      LOGERR(("enquire->get_mset: exception: %s\n", 
351
      LOGERR(("enquire->get_mset: exception: %s\n", 
351
                  error.get_msg().c_str()));
352
                  error.get_msg().c_str()));
353
          m_reason = error.get_msg();
352
          return false;
354
          return false;
353
    }
355
    }
354
    if (m_nq->mset.empty())
356
    if (m_nq->mset.empty())
355
        return false;
357
        return false;
356
    first = m_nq->mset.get_firstitem();
358
    first = m_nq->mset.get_firstitem();
...
...
359
361
360
    LOGDEB1(("Query::getDoc: Qry [%s] win [%d-%d] Estimated results: %d",
362
    LOGDEB1(("Query::getDoc: Qry [%s] win [%d-%d] Estimated results: %d",
361
            m_nq->query.get_description().c_str(), 
363
            m_nq->query.get_description().c_str(), 
362
            first, last, m_nq->mset.get_matches_lower_bound()));
364
            first, last, m_nq->mset.get_matches_lower_bound()));
363
365
366
    Xapian::Document xdoc;
367
    Xapian::docid docid = 0;
368
    int pc = 0;
369
    string data;
370
    m_reason.erase();
371
    for (int xaptries=0; xaptries < 2; xaptries++) {
372
        try {
364
    Xapian::Document xdoc = m_nq->mset[xapi-first].get_document();
373
            xdoc = m_nq->mset[xapi-first].get_document();
365
    Xapian::docid docid = *(m_nq->mset[xapi-first]);
374
            docid = *(m_nq->mset[xapi-first]);
366
    int pc = m_nq->mset.convert_to_percent(m_nq->mset[xapi-first]);
375
            pc = m_nq->mset.convert_to_percent(m_nq->mset[xapi-first]);
376
            data = xdoc.get_data();
377
            m_reason.erase();
378
            break;
379
        } catch (Xapian::DatabaseModifiedError &error) {
380
            // retry or end of loop
381
            LOGDEB(("getDoc: caught DatabaseModified\n"));
382
            m_reason = error.get_msg();
383
            continue;
384
        }
385
        XCATCHERROR(m_reason);
386
        break;
387
    }
367
388
368
    // Parse xapian document's data and populate doc fields
389
    // Parse xapian document's data and populate doc fields
369
    string data = xdoc.get_data();
390
    return m_reason.empty() ? 
370
    return m_db->m_ndb->dbDataToRclDoc(docid, data, doc, pc);
391
        m_db->m_ndb->dbDataToRclDoc(docid, data, doc, pc) : false;
371
}
392
}
372
393
373
list<string> Query::expand(const Doc &doc)
394
list<string> Query::expand(const Doc &doc)
374
{
395
{
375
    list<string> res;
396
    list<string> res;