|
a/src/query/plaintorich.cpp |
|
b/src/query/plaintorich.cpp |
|
... |
|
... |
154 |
};
|
154 |
};
|
155 |
|
155 |
|
156 |
#define SETMINMAX(POS, STA, STO) {if ((POS) < (STA)) (STA) = (POS); \
|
156 |
#define SETMINMAX(POS, STA, STO) {if ((POS) < (STA)) (STA) = (POS); \
|
157 |
if ((POS) > (STO)) (STO) = (POS);}
|
157 |
if ((POS) > (STO)) (STO) = (POS);}
|
158 |
|
158 |
|
159 |
// Recursively check that each term is inside the window (which is
|
159 |
// Check that at least an entry from the first position list is inside
|
|
|
160 |
// the window and recurse on next list. The window is readjusted as
|
160 |
// readjusted as the successive terms are found).
|
161 |
// the successive terms are found.
|
|
|
162 |
//
|
161 |
// @param window the search window width
|
163 |
// @param window the search window width
|
162 |
// @param plists the position list vector
|
164 |
// @param plists the position list vector
|
163 |
// @param i the position list to process (we then recurse with the next list)
|
165 |
// @param i the position list to process (we then recurse with the next list)
|
164 |
// @param min the current minimum pos for a found term
|
166 |
// @param min the current minimum pos for a found term
|
165 |
// @param max the current maximum pos for a found term
|
167 |
// @param max the current maximum pos for a found term
|
|
... |
|
... |
180 |
// Find 1st position bigger than window start
|
182 |
// Find 1st position bigger than window start
|
181 |
vector<int>::iterator it = plists[i]->begin();
|
183 |
vector<int>::iterator it = plists[i]->begin();
|
182 |
while (it != plists[i]->end() && *it < tmp)
|
184 |
while (it != plists[i]->end() && *it < tmp)
|
183 |
it++;
|
185 |
it++;
|
184 |
|
186 |
|
185 |
// Try each position inside window in turn for match with other lists
|
187 |
// Look for position inside window. If not found, no match. If
|
|
|
188 |
// found: if this is the last list we're done, else recurse on
|
|
|
189 |
// next list after adjusting the window
|
186 |
while (it != plists[i]->end()) {
|
190 |
while (it != plists[i]->end()) {
|
187 |
int pos = *it;
|
191 |
int pos = *it;
|
188 |
if (pos > min + window - 1)
|
192 |
if (pos > min + window - 1)
|
189 |
return false;
|
193 |
return false;
|
190 |
if (i + 1 == plists.size()) {
|
194 |
if (i + 1 == plists.size()) {
|
|
... |
|
... |
280 |
i2->second.second, grpidx));
|
284 |
i2->second.second, grpidx));
|
281 |
} else {
|
285 |
} else {
|
282 |
LOGDEB(("matchGroup: no bpos found for %d or %d\n", sta, sto));
|
286 |
LOGDEB(("matchGroup: no bpos found for %d or %d\n", sta, sto));
|
283 |
}
|
287 |
}
|
284 |
} else {
|
288 |
} else {
|
285 |
LOGDEB0(("matchGroup: no group match found at this position\n"));
|
289 |
LOGDEB1(("matchGroup: no group match found at this position\n"));
|
286 |
}
|
290 |
}
|
287 |
}
|
291 |
}
|
288 |
|
292 |
|
289 |
return true;
|
293 |
return true;
|
290 |
}
|
294 |
}
|