| 43 | ~IdfMapDelegate() override = default; |
| 44 | |
| 45 | uint64_t GetNumDocs(UniString const & token, bool isPrefix) const override |
| 46 | { |
| 47 | if (isPrefix) |
| 48 | { |
| 49 | for (auto const & dfa : m_prefixToDf) |
| 50 | { |
| 51 | auto it = dfa.first.Begin(); |
| 52 | DFAMove(it, token); |
| 53 | if (it.Accepts()) |
| 54 | return dfa.second; |
| 55 | } |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | for (auto const & dfa : m_tokensToDf) |
| 60 | { |
| 61 | auto it = dfa.first.Begin(); |
| 62 | DFAMove(it, token); |
| 63 | if (it.Accepts()) |
| 64 | return dfa.second; |
| 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | private: |
| 70 | vector<pair<LevenshteinDFA, uint64_t>> const & m_tokensToDf; |