Switch to unified view

a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp
...
...
532
    list<string> res;
532
    list<string> res;
533
    stringToStrings(Xapian::Stem::get_available_languages(), res);
533
    stringToStrings(Xapian::Stem::get_available_languages(), res);
534
    return res;
534
    return res;
535
}
535
}
536
536
537
bool Db::open(OpenMode mode)
537
bool Db::open(OpenMode mode, OpenError *error)
538
{
538
{
539
    if (error)
540
  *error = DbOpenMainDb;
541
539
    if (m_ndb == 0 || m_config == 0) {
542
    if (m_ndb == 0 || m_config == 0) {
540
    m_reason = "Null configuration or Xapian Db";
543
    m_reason = "Null configuration or Xapian Db";
541
    return false;
544
    return false;
542
    }
545
    }
543
    LOGDEB(("Db::open: m_isopen %d m_iswritable %d\n", m_ndb->m_isopen, 
546
    LOGDEB(("Db::open: m_isopen %d m_iswritable %d\n", m_ndb->m_isopen, 
...
...
584
    default:
587
    default:
585
        m_ndb->m_iswritable = false;
588
        m_ndb->m_iswritable = false;
586
        m_ndb->xrdb = Xapian::Database(dir);
589
        m_ndb->xrdb = Xapian::Database(dir);
587
        for (list<string>::iterator it = m_extraDbs.begin();
590
        for (list<string>::iterator it = m_extraDbs.begin();
588
         it != m_extraDbs.end(); it++) {
591
         it != m_extraDbs.end(); it++) {
592
      if (error)
593
          *error = DbOpenExtraDb;
589
        LOGDEB(("Db::Open: adding query db [%s]\n", it->c_str()));
594
        LOGDEB(("Db::Open: adding query db [%s]\n", it->c_str()));
590
                // Used to be non-fatal (1.13 and older) but I can't see why
595
                // An error here used to be non-fatal (1.13 and older)
596
                // but I can't see why
591
                m_ndb->xrdb.add_database(Xapian::Database(*it));
597
                m_ndb->xrdb.add_database(Xapian::Database(*it));
592
        }
598
        }
593
        break;
599
        break;
594
    }
600
    }
601
  if (error)
602
      *error = DbOpenMainDb;
595
603
596
    // Check index format version. Must not try to check a just created or
604
    // Check index format version. Must not try to check a just created or
597
    // truncated db
605
    // truncated db
598
    if (mode != DbTrunc && m_ndb->xdb().get_doccount() > 0) {
606
    if (mode != DbTrunc && m_ndb->xdb().get_doccount() > 0) {
599
        string version = m_ndb->xdb().get_metadata(RCL_IDX_VERSION_KEY);
607
        string version = m_ndb->xdb().get_metadata(RCL_IDX_VERSION_KEY);
...
...
606
        }
614
        }
607
    }
615
    }
608
    m_mode = mode;
616
    m_mode = mode;
609
    m_ndb->m_isopen = true;
617
    m_ndb->m_isopen = true;
610
    m_basedir = dir;
618
    m_basedir = dir;
619
  if (error)
620
      *error = DbOpenNoError;
611
    return true;
621
    return true;
612
    } XCATCHERROR(ermsg);
622
    } XCATCHERROR(ermsg);
613
623
614
    m_reason = ermsg;
624
    m_reason = ermsg;
615
    LOGERR(("Db::open: exception while opening [%s]: %s\n", 
625
    LOGERR(("Db::open: exception while opening [%s]: %s\n",