Changeset View
Changeset View
Standalone View
Standalone View
src/engine/queryparser.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 47 | { | |||
---|---|---|---|---|---|
63 | 63 | | |||
64 | QTextBoundaryFinder bf(QTextBoundaryFinder::Word, text); | 64 | QTextBoundaryFinder bf(QTextBoundaryFinder::Word, text); | ||
65 | for (; bf.position() != -1; bf.toNextBoundary()) { | 65 | for (; bf.position() != -1; bf.toNextBoundary()) { | ||
66 | if (bf.boundaryReasons() & QTextBoundaryFinder::StartOfItem) { | 66 | if (bf.boundaryReasons() & QTextBoundaryFinder::StartOfItem) { | ||
67 | // | 67 | // | ||
68 | // Check the previous delimiter | 68 | // Check the previous delimiter | ||
69 | int pos = bf.position(); | 69 | int pos = bf.position(); | ||
70 | if (pos != end) { | 70 | if (pos != end) { | ||
71 | QString delim = text.mid(end, pos-end); | 71 | QString delim = text_.mid(end, pos-end); | ||
72 | if (delim.contains(QLatin1Char('"'))) { | 72 | if (delim.contains(QLatin1Char('"'))) { | ||
73 | if (inDoubleQuotes) { | 73 | if (inDoubleQuotes) { | ||
74 | queries << EngineQuery(phraseQueries, EngineQuery::Phrase); | 74 | queries << EngineQuery(phraseQueries, EngineQuery::Phrase); | ||
75 | phraseQueries.clear(); | 75 | phraseQueries.clear(); | ||
76 | inDoubleQuotes = false; | 76 | inDoubleQuotes = false; | ||
77 | } | 77 | } | ||
78 | else { | 78 | else { | ||
79 | inDoubleQuotes = true; | 79 | inDoubleQuotes = true; | ||
Show All 9 Lines | 88 | else { | |||
89 | inSingleQuotes = true; | 89 | inSingleQuotes = true; | ||
90 | } | 90 | } | ||
91 | } | 91 | } | ||
92 | else if (!containsSpace(delim)) { | 92 | else if (!containsSpace(delim)) { | ||
93 | if (!inPhrase && !queries.isEmpty()) { | 93 | if (!inPhrase && !queries.isEmpty()) { | ||
94 | EngineQuery q = queries.takeLast(); | 94 | EngineQuery q = queries.takeLast(); | ||
95 | q.setOp(EngineQuery::Equal); | 95 | q.setOp(EngineQuery::Equal); | ||
96 | phraseQueries << q; | 96 | phraseQueries << q; | ||
97 | } | | |||
98 | inPhrase = true; | 97 | inPhrase = true; | ||
99 | } | 98 | } | ||
99 | } | ||||
100 | else if (inPhrase && !phraseQueries.isEmpty()) { | 100 | else if (inPhrase && !phraseQueries.isEmpty()) { | ||
101 | queries << EngineQuery(phraseQueries, EngineQuery::Phrase); | 101 | queries << EngineQuery(phraseQueries, EngineQuery::Phrase); | ||
102 | phraseQueries.clear(); | 102 | phraseQueries.clear(); | ||
103 | inPhrase = false; | 103 | inPhrase = false; | ||
104 | } | 104 | } | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | start = bf.position(); | 107 | start = bf.position(); | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |