Changeset View
Changeset View
Standalone View
Standalone View
src/engine/phraseanditerator.cpp
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | 15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library; if not, write to the Free Software | 16 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "phraseanditerator.h" | 21 | #include "phraseanditerator.h" | ||
22 | #include "positioninfo.h" | ||||
22 | 23 | | |||
23 | using namespace Baloo; | 24 | using namespace Baloo; | ||
24 | 25 | | |||
25 | PhraseAndIterator::PhraseAndIterator(const QVector<PostingIterator*>& iterators) | 26 | PhraseAndIterator::PhraseAndIterator(const QVector<VectorPositionInfoIterator*>& iterators) | ||
26 | : m_iterators(iterators) | 27 | : m_iterators(iterators) | ||
27 | , m_docId(0) | 28 | , m_docId(0) | ||
28 | { | 29 | { | ||
29 | if (m_iterators.contains(nullptr)) { | 30 | if (m_iterators.contains(nullptr)) { | ||
30 | qDeleteAll(m_iterators); | 31 | qDeleteAll(m_iterators); | ||
31 | m_iterators.clear(); | 32 | m_iterators.clear(); | ||
32 | } | 33 | } | ||
33 | } | 34 | } | ||
Show All 9 Lines | |||||
43 | } | 44 | } | ||
44 | 45 | | |||
45 | bool PhraseAndIterator::checkIfPositionsMatch() | 46 | bool PhraseAndIterator::checkIfPositionsMatch() | ||
46 | { | 47 | { | ||
47 | QVector< QVector<uint> > positionList; | 48 | QVector< QVector<uint> > positionList; | ||
48 | positionList.reserve(m_iterators.size()); | 49 | positionList.reserve(m_iterators.size()); | ||
49 | // All the iterators should have the same value | 50 | // All the iterators should have the same value | ||
50 | for (int i = 0; i < m_iterators.size(); i++) { | 51 | for (int i = 0; i < m_iterators.size(); i++) { | ||
51 | PostingIterator* iter = m_iterators[i]; | 52 | auto* iter = m_iterators[i]; | ||
52 | Q_ASSERT(iter->docId() == m_docId); | 53 | Q_ASSERT(iter->docId() == m_docId); | ||
53 | 54 | | |||
54 | QVector<uint> pi = iter->positions(); | 55 | QVector<uint> pi = iter->positions(); | ||
55 | for (int j = 0; j < pi.size(); j++) { | 56 | for (int j = 0; j < pi.size(); j++) { | ||
56 | pi[j] -= i; | 57 | pi[j] -= i; | ||
57 | } | 58 | } | ||
58 | 59 | | |||
59 | positionList << pi; | 60 | positionList << pi; | ||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |