Switch to unified view

a/src/query/docseqdb.cpp b/src/query/docseqdb.cpp
...
...
49
    return m_fsdata->getDescription();
49
    return m_fsdata->getDescription();
50
}
50
}
51
51
52
bool DocSequenceDb::getDoc(int num, Rcl::Doc &doc, string *sh)
52
bool DocSequenceDb::getDoc(int num, Rcl::Doc &doc, string *sh)
53
{
53
{
54
    setQuery();
54
    if (!setQuery())
55
  return false;
55
    if (sh) sh->erase();
56
    if (sh) sh->erase();
56
    return m_q->getDoc(num, doc);
57
    return m_q->getDoc(num, doc);
57
}
58
}
58
59
59
int DocSequenceDb::getResCnt()
60
int DocSequenceDb::getResCnt()
60
{
61
{
61
    setQuery();
62
    if (!setQuery())
63
  return false;
62
    if (m_rescnt < 0) {
64
    if (m_rescnt < 0) {
63
    m_rescnt= m_q->getResCnt();
65
    m_rescnt= m_q->getResCnt();
64
    }
66
    }
65
    return m_rescnt;
67
    return m_rescnt;
66
}
68
}
...
...
69
// This one only gets called to fill-up the snippets window
71
// This one only gets called to fill-up the snippets window
70
// We ignore most abstract/snippets preferences.
72
// We ignore most abstract/snippets preferences.
71
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
73
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
72
{
74
{
73
    LOGDEB(("DocSequenceDb::getAbstract/pair\n"));
75
    LOGDEB(("DocSequenceDb::getAbstract/pair\n"));
74
    setQuery();
76
    if (!setQuery())
77
  return false;
75
78
76
    // Have to put the limit somewhere. 
79
    // Have to put the limit somewhere. 
77
    int maxoccs = 500;
80
    int maxoccs = 500;
78
    Rcl::abstract_result ret = Rcl::ABSRES_ERROR;
81
    Rcl::abstract_result ret = Rcl::ABSRES_ERROR;
79
    if (m_q->whatDb()) {
82
    if (m_q->whatDb()) {
...
...
91
    return true;
94
    return true;
92
}
95
}
93
96
94
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
97
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
95
{
98
{
96
    setQuery();
99
    if (!setQuery())
100
  return false;
97
    if (m_q->whatDb() &&
101
    if (m_q->whatDb() &&
98
    m_queryBuildAbstract && (doc.syntabs || m_queryReplaceAbstract)) {
102
    m_queryBuildAbstract && (doc.syntabs || m_queryReplaceAbstract)) {
99
    m_q->makeDocAbstract(doc, vabs);
103
    m_q->makeDocAbstract(doc, vabs);
100
    } 
104
    } 
101
    if (vabs.empty())
105
    if (vabs.empty())
...
...
103
    return true;
107
    return true;
104
}
108
}
105
109
106
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
110
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
107
{
111
{
108
    setQuery();
112
    if (!setQuery())
113
  return false;
109
    if (m_q->whatDb()) {
114
    if (m_q->whatDb()) {
110
    return m_q->getFirstMatchPage(doc, term);
115
    return m_q->getFirstMatchPage(doc, term);
111
    }
116
    }
112
    return -1;
117
    return -1;
113
}
118
}
114
119
115
bool DocSequenceDb::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc) 
120
bool DocSequenceDb::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc) 
116
{
121
{
117
    setQuery();
122
    if (!setQuery())
123
  return false;
118
    string udi;
124
    string udi;
119
    if (!FileInterner::getEnclosing(doc.url, doc.ipath, pdoc.url, pdoc.ipath,
125
    if (!FileInterner::getEnclosing(doc.url, doc.ipath, pdoc.url, pdoc.ipath,
120
                                    udi))
126
                                    udi))
121
        return false;
127
        return false;
122
    return m_q->whatDb()->getDoc(udi, pdoc);
128
    return m_q->whatDb()->getDoc(udi, pdoc);
123
}
129
}
124
130
125
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
131
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
126
{
132
{
127
    setQuery();
133
    if (!setQuery())
134
  return list<string>();
128
    vector<string> v = m_q->expand(doc);
135
    vector<string> v = m_q->expand(doc);
129
    return list<string>(v.begin(), v.end());
136
    return list<string>(v.begin(), v.end());
130
}
137
}
131
138
132
string DocSequenceDb::title()
139
string DocSequenceDb::title()
...
...
207
{
214
{
208
    if (!m_needSetQuery)
215
    if (!m_needSetQuery)
209
    return true;
216
    return true;
210
    m_rescnt = -1;
217
    m_rescnt = -1;
211
    m_needSetQuery = !m_q->setQuery(m_fsdata);
218
    m_needSetQuery = !m_q->setQuery(m_fsdata);
212
219
    if (m_needSetQuery) {
213
#if 0
220
  m_reason = m_q->getReason();
214
  HighlightData hld;
221
  LOGERR(("DocSequenceDb::setQuery: rclquery::setQuery failed: %s\n",
215
  m_fsdata->getTerms(hld);
222
      m_reason.c_str()));
216
  string str; 
223
    }
217
  hld.toString(str);
218
  fprintf(stderr, "DocSequenceDb::setQuery: terms: %s\n", str.c_str());
219
#endif
220
    return !m_needSetQuery;
224
    return !m_needSetQuery;
221
}
225
}