forked from Mirrors/privacore-open-source-search-engine
Remove now unused function docHasQueryTerms
This commit is contained in:
66
Matches.cpp
66
Matches.cpp
@ -959,69 +959,3 @@ int32_t Matches::getNumWordsInMatch( Words *words, int32_t wn, int32_t n, int32_
|
||||
return wn - wn0 + 1;
|
||||
}
|
||||
|
||||
bool Matches::docHasQueryTerms(int32_t totalInlinks) {
|
||||
// Loop through all matches keeping a count of query term matches
|
||||
// from link text.
|
||||
// If a match is not from a link text max it out.
|
||||
// Tally up the matched terms vs number of matches
|
||||
// if only one or two link text matches out of > 10 then
|
||||
// return false indicating that the doc does not
|
||||
// have the term
|
||||
|
||||
if(m_numMatches == 0) {
|
||||
// if there is no query and no matches then short circuit
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t qterms = 1024;
|
||||
int32_t tmpBuf[qterms];
|
||||
int32_t *numMatches = tmpBuf;
|
||||
|
||||
if(qterms < m_q->m_numTerms) {
|
||||
qterms = m_q->m_numTerms;
|
||||
numMatches = (int32_t *)mmalloc(qterms * sizeof(int32_t),
|
||||
"matchesAnomaly");
|
||||
}
|
||||
memset(numMatches, 0, qterms * sizeof(int32_t));
|
||||
|
||||
for ( int32_t i = 0 ; i < m_numMatches ; i++ ) {
|
||||
// get the match
|
||||
Match *m = &m_matches[i];
|
||||
if(m->m_flags & MF_LINK) {
|
||||
numMatches[m->m_qwordNum]++;
|
||||
continue;
|
||||
}
|
||||
numMatches[m->m_qwordNum] = m_numMatches;
|
||||
}
|
||||
|
||||
|
||||
// Assume the best, since we're really only after anomalous link text
|
||||
// at this point.
|
||||
bool hasTerms = true;
|
||||
int32_t nqt = m_q->m_numTerms;
|
||||
for ( int32_t i = 0 ; i < nqt ; i++ ) {
|
||||
QueryTerm *qt = &m_q->m_qterms[i];
|
||||
// For purposes of matching, we ignore all stop words
|
||||
if ( ! isMatchableTerm ( qt ) || qt->m_ignored ||
|
||||
(qt->m_isPhrase && !qt->m_isRequired)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the word it is from
|
||||
QueryWord *qw = qt->m_qword;
|
||||
|
||||
// It is a match if it matched something other than link text
|
||||
// or it matched at least 1 link text and there arent many link texts
|
||||
// or it matched more than 2 link texts and there are many link texts
|
||||
hasTerms &= ((numMatches[qw->m_wordNum] >= m_numMatches) ||
|
||||
(numMatches[qw->m_wordNum] > 0 && totalInlinks < 10) ||
|
||||
(numMatches[qw->m_wordNum] > 2 && totalInlinks > 10));
|
||||
|
||||
}
|
||||
|
||||
if (numMatches != tmpBuf) {
|
||||
mfree(numMatches, qterms * sizeof(int32_t), "matchesAnomaly");
|
||||
}
|
||||
return hasTerms;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,6 @@ class Matches {
|
||||
void reset ( ) ;
|
||||
void reset2 ( ) ;
|
||||
|
||||
bool docHasQueryTerms(int32_t totalInlinks);
|
||||
|
||||
// used internally and by PageGet.cpp
|
||||
bool isMatchableTerm ( class QueryTerm *qt );
|
||||
|
||||
|
Reference in New Issue
Block a user