Switch to unified view

a/src/query/wasatorcl.cpp b/src/query/wasatorcl.cpp
...
...
30
#include "smallut.h"
30
#include "smallut.h"
31
#include "rclconfig.h"
31
#include "rclconfig.h"
32
#include "refcntr.h"
32
#include "refcntr.h"
33
#include "textsplit.h"
33
#include "textsplit.h"
34
34
35
static Rcl::SearchData *wasaQueryToRcl(RclConfig *config, WasaQuery *wasa, 
35
static Rcl::SearchData *wasaQueryToRcl(RclConfig *config, 
36
                     const string& stemlang,
37
                     WasaQuery *wasa, 
36
                       const string& autosuffs, string& reason)
38
                       const string& autosuffs, string& reason)
37
{
39
{
38
    if (wasa == 0) {
40
    if (wasa == 0) {
39
    reason = "NULL query";
41
    reason = "NULL query";
40
    return 0;
42
    return 0;
...
...
45
    return 0;
47
    return 0;
46
    }
48
    }
47
49
48
    Rcl::SearchData *sdata = new 
50
    Rcl::SearchData *sdata = new 
49
    Rcl::SearchData(wasa->m_op == WasaQuery::OP_AND ? Rcl::SCLT_AND : 
51
    Rcl::SearchData(wasa->m_op == WasaQuery::OP_AND ? Rcl::SCLT_AND : 
50
            Rcl::SCLT_OR);
52
            Rcl::SCLT_OR, stemlang);
51
    LOGDEB2(("wasaQueryToRcl: %s chain\n", wasa->m_op == WasaQuery::OP_AND ? 
53
    LOGDEB2(("wasaQueryToRcl: %s chain\n", wasa->m_op == WasaQuery::OP_AND ? 
52
         "AND" : "OR"));
54
         "AND" : "OR"));
53
55
54
    WasaQuery::subqlist_t::iterator it;
56
    WasaQuery::subqlist_t::iterator it;
55
    Rcl::SearchDataClause *nclause;
57
    Rcl::SearchDataClause *nclause;
...
...
165
        continue;
167
        continue;
166
    } 
168
    } 
167
169
168
    // "Regular" processing follows:
170
    // "Regular" processing follows:
169
    unsigned int mods = (unsigned int)(*it)->m_modifiers;
171
    unsigned int mods = (unsigned int)(*it)->m_modifiers;
172
  LOGDEB0(("wasaQueryToRcl: clause modifiers 0x%x\n", mods));
170
    nclause = 0;
173
    nclause = 0;
171
174
172
    switch ((*it)->m_op) {
175
    switch ((*it)->m_op) {
173
    case WasaQuery::OP_NULL:
176
    case WasaQuery::OP_NULL:
174
    case WasaQuery::OP_AND:
177
    case WasaQuery::OP_AND:
...
...
176
        reason = "Found bad NULL or AND query type in list";
179
        reason = "Found bad NULL or AND query type in list";
177
        LOGERR(("wasaQueryToRcl: found bad NULL or AND q type in list\n"));
180
        LOGERR(("wasaQueryToRcl: found bad NULL or AND q type in list\n"));
178
        continue;
181
        continue;
179
182
180
    case WasaQuery::OP_LEAF: {
183
    case WasaQuery::OP_LEAF: {
181
        LOGDEB(("wasaQueryToRcl: leaf clause [%s]:[%s] slack %d\n", 
184
        LOGDEB0(("wasaQueryToRcl: leaf clause [%s]:[%s] slack %d\n", 
182
            (*it)->m_fieldspec.c_str(), (*it)->m_value.c_str(),
185
            (*it)->m_fieldspec.c_str(), (*it)->m_value.c_str(),
183
            (*it)->m_slack));
186
            (*it)->m_slack));
184
187
185
            // Change terms found in the "autosuffs" list into "ext"
188
            // Change terms found in the "autosuffs" list into "ext"
186
            // field queries
189
            // field queries
...
...
248
    case WasaQuery::OP_OR:
251
    case WasaQuery::OP_OR:
249
        LOGDEB2(("wasaQueryToRcl: OR clause [%s]:[%s]\n", 
252
        LOGDEB2(("wasaQueryToRcl: OR clause [%s]:[%s]\n", 
250
             (*it)->m_fieldspec.c_str(), (*it)->m_value.c_str()));
253
             (*it)->m_fieldspec.c_str(), (*it)->m_value.c_str()));
251
        // Create a subquery.
254
        // Create a subquery.
252
        Rcl::SearchData *sub = 
255
        Rcl::SearchData *sub = 
253
        wasaQueryToRcl(config, *it, autosuffs, reason);
256
        wasaQueryToRcl(config, stemlang, *it, autosuffs, reason);
254
        if (sub == 0) {
257
        if (sub == 0) {
255
        continue;
258
        continue;
256
        }
259
        }
257
        nclause = 
260
        nclause = 
258
        new Rcl::SearchDataClauseSub(Rcl::SCLT_SUB, 
261
        new Rcl::SearchDataClauseSub(Rcl::SCLT_SUB, 
...
...
276
    }
279
    }
277
280
278
    return sdata;
281
    return sdata;
279
}
282
}
280
283
281
Rcl::SearchData *wasaStringToRcl(RclConfig *config, 
284
Rcl::SearchData *wasaStringToRcl(RclConfig *config, const string& stemlang,
282
                 const string &qs, string &reason, 
285
                 const string &qs, string &reason, 
283
                                 const string& autosuffs)
286
                                 const string& autosuffs)
284
{
287
{
285
    StringToWasaQuery parser;
288
    StringToWasaQuery parser;
286
    WasaQuery *wq = parser.stringToQuery(qs, reason);
289
    WasaQuery *wq = parser.stringToQuery(qs, reason);
287
    if (wq == 0) 
290
    if (wq == 0) 
288
    return 0;
291
    return 0;
289
    return wasaQueryToRcl(config, wq, autosuffs, reason);
292
    return wasaQueryToRcl(config, stemlang, wq, autosuffs, reason);
290
}
293
}