Switch to unified view

a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp
...
...
88
    vector<string> words;
88
    vector<string> words;
89
    // Walk the clause list. If we find any non simple clause or different
89
    // Walk the clause list. If we find any non simple clause or different
90
    // field names, bail out.
90
    // field names, bail out.
91
    for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++) {
91
    for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++) {
92
    SClType tp = (*it)->m_tp;
92
    SClType tp = (*it)->m_tp;
93
  if (tp != SCLT_AND && tp != SCLT_OR) {
94
      LOGDEB2(("SearchData::maybeAddAutoPhrase: rejected clause\n"));
95
      return false;
96
  }
97
    SearchDataClauseSimple *clp = 
93
    SearchDataClauseSimple *clp = 0;
94
        if (tp == SCLT_SUB) {
95
            // The query language parser produces subqueries for simple terms
96
            SearchDataClauseSub *subclp = 
98
      dynamic_cast<SearchDataClauseSimple*>(*it);
97
                dynamic_cast<SearchDataClauseSub*>(*it);
98
            if (subclp == 0) {
99
                LOGDEB2(("SearchData::maybeAddAutoPhrase: "
100
                         "dyncast to clauseSub failed\n"));
101
                return false;
102
            }
103
            if (!subclp->getSub()->singleSimple()) {
104
                LOGDEB2(("SearchData::maybeAddAutoPhrase: !pureSingle\n"));
105
                return false;
106
            }
107
            clp = dynamic_cast<SearchDataClauseSimple*>(
108
                *(subclp->getSub()->m_query.begin()));
109
        } else if (tp != SCLT_AND && tp != SCLT_OR) {
110
            LOGDEB2(("SearchData::maybeAddAutoPhrase: wrong tp %d\n", tp));
111
      return false;
112
  } else {
113
            clp = dynamic_cast<SearchDataClauseSimple*>(*it);
114
        }
99
    if (clp == 0) {
115
    if (clp == 0) {
100
        LOGDEB2(("SearchData::maybeAddAutoPhrase: dyncast failed\n"));
116
        LOGDEB2(("SearchData::maybeAddAutoPhrase: dyncast failed\n"));
101
        return false;
117
        return false;
102
    }
118
    }
103
    if (it == m_query.begin()) {
119
    if (it == m_query.begin()) {
...
...
181
    if (!(*it)->isFileName())
197
    if (!(*it)->isFileName())
182
        return false;
198
        return false;
183
    return true;
199
    return true;
184
}
200
}
185
201
202
bool SearchData::singleSimple()
203
{
204
    if (m_query.size() != 1 || !m_filetypes.empty() || !m_nfiletypes.empty() ||
205
        m_haveDates || m_maxSize != size_t(-1) || m_minSize != size_t(-1) ||
206
        m_haveWildCards)
207
        return false;
208
    SearchDataClause *clp = *m_query.begin();
209
    if (clp->getTp() != SCLT_AND && clp->getTp() != SCLT_OR)
210
        return false;
211
    return true;
212
}
213
186
// Extract all term data
214
// Extract all term data
187
void SearchData::getTerms(HighlightData &hld) const
215
void SearchData::getTerms(HighlightData &hld) const
188
{
216
{
189
    for (qlist_cit_t it = m_query.begin(); it != m_query.end(); it++)
217
    for (qlist_cit_t it = m_query.begin(); it != m_query.end(); it++)
190
    (*it)->getTerms(hld);
218
    (*it)->getTerms(hld);