Switch to unified view

a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp
...
...
208
            continue;
208
            continue;
209
209
210
        clsubp->getSub()->simplify();
210
        clsubp->getSub()->simplify();
211
211
212
        // If this subquery has special attributes, it's not a
212
        // If this subquery has special attributes, it's not a
213
        // candidate for collapsing
213
        // candidate for collapsing, except if it has no clauses, because
214
        // then, we just pick the attributes.
214
        if (!clsubp->getSub()->m_filetypes.empty() || 
215
        if (!clsubp->getSub()->m_filetypes.empty() || 
215
            !clsubp->getSub()->m_nfiletypes.empty() ||
216
            !clsubp->getSub()->m_nfiletypes.empty() ||
216
            clsubp->getSub()->m_haveDates || 
217
            clsubp->getSub()->m_haveDates || 
217
            clsubp->getSub()->m_maxSize != size_t(-1) ||
218
            clsubp->getSub()->m_maxSize != size_t(-1) ||
218
            clsubp->getSub()->m_minSize != size_t(-1) ||
219
            clsubp->getSub()->m_minSize != size_t(-1) ||
219
            clsubp->getSub()->m_haveWildCards)
220
            clsubp->getSub()->m_haveWildCards) {
221
            if (!clsubp->getSub()->m_query.empty())
220
            continue;
222
                continue;
223
            m_filetypes.insert(m_filetypes.end(),
224
                               clsubp->getSub()->m_filetypes.begin(),
225
                               clsubp->getSub()->m_filetypes.end());
226
            m_nfiletypes.insert(m_nfiletypes.end(),
227
                               clsubp->getSub()->m_nfiletypes.begin(),
228
                               clsubp->getSub()->m_nfiletypes.end());
229
            if (clsubp->getSub()->m_haveDates && !m_haveDates) {
230
                m_dates = clsubp->getSub()->m_dates;
231
            }
232
            if (m_maxSize == size_t(-1))
233
                m_maxSize = clsubp->getSub()->m_maxSize;
234
            if (m_minSize == size_t(-1))
235
                m_minSize = clsubp->getSub()->m_minSize;
236
            m_haveWildCards = m_haveWildCards ||
237
                clsubp->getSub()->m_haveWildCards;
238
            // And then let the clauses processing go on, there are
239
            // none anyway, we will just delete the subquery.
240
        }
241
        
221
242
222
        bool allsametp = true;
243
        bool allsametp = true;
223
        for (qlist_it_t it1 = clsubp->getSub()->m_query.begin(); 
244
        for (qlist_it_t it1 = clsubp->getSub()->m_query.begin(); 
224
             it1 != clsubp->getSub()->m_query.end(); it1++) {
245
             it1 != clsubp->getSub()->m_query.end(); it1++) {
225
            // We want all AND or OR clause, and same as our conjunction
246
            // We want all AND or OR clause, and same as our conjunction
...
...
275
    case SCLT_SUB: return "SUB";
296
    case SCLT_SUB: return "SUB";
276
    default: return "UNKNOWN";
297
    default: return "UNKNOWN";
277
    }
298
    }
278
}
299
}
279
300
301
static string dumptabs;
302
280
void SearchData::dump(ostream& o) const
303
void SearchData::dump(ostream& o) const
281
{
304
{
305
    o << dumptabs <<
282
    o << "SearchData: " << tpToString(m_tp) << " qs " << int(m_query.size()) << 
306
        "SearchData: " << tpToString(m_tp) << " qs " << int(m_query.size()) << 
283
        " ft " << m_filetypes.size() << " nft " << m_nfiletypes.size() << 
307
        " ft " << m_filetypes.size() << " nft " << m_nfiletypes.size() << 
284
        " hd " << m_haveDates << " maxs " << int(m_maxSize) << " mins " << 
308
        " hd " << m_haveDates << " maxs " << int(m_maxSize) << " mins " << 
285
        int(m_minSize) << " wc " << m_haveWildCards << "\n";
309
        int(m_minSize) << " wc " << m_haveWildCards << "\n";
286
    for (std::vector<SearchDataClause*>::const_iterator it =
310
    for (std::vector<SearchDataClause*>::const_iterator it =
287
             m_query.begin(); it != m_query.end(); it++) {
311
             m_query.begin(); it != m_query.end(); it++) {
312
        o << dumptabs;
288
        (*it)->dump(o);
313
        (*it)->dump(o);
289
        o << "\n";
314
        o << "\n";
290
    }
315
    }
291
    o << "\n";
316
//    o << dumptabs << "\n";
292
}
317
}
293
318
294
void SearchDataClause::dump(ostream& o) const
319
void SearchDataClause::dump(ostream& o) const
295
{
320
{
296
    o << "SearchDataClause??";
321
    o << "SearchDataClause??";
...
...
339
}
364
}
340
365
341
void SearchDataClauseSub::dump(ostream& o) const
366
void SearchDataClauseSub::dump(ostream& o) const
342
{
367
{
343
    o << "ClauseSub {\n";
368
    o << "ClauseSub {\n";
369
    dumptabs += '\t';
344
    m_sub->dump(o);
370
    m_sub->dump(o);
345
    o << "}";
371
    dumptabs.erase(dumptabs.size()- 1);
372
    o << dumptabs << "}";
346
}
373
}
347
374
348
} // Namespace Rcl
375
} // Namespace Rcl