From 132ea3b946d9c4e8fcb59bdb9888ddefdb7d17b0 Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Wed, 6 Apr 2011 22:16:03 +0200 Subject: [PATCH] [sloynik] Add dictionary size and number of keys to the stamp, so that when they change, index is regenerated. --- words/sloynik_engine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/words/sloynik_engine.cpp b/words/sloynik_engine.cpp index b30a52b708..61350a6dd1 100644 --- a/words/sloynik_engine.cpp +++ b/words/sloynik_engine.cpp @@ -10,10 +10,14 @@ sl::SloynikEngine::SloynikEngine(string const & dictionaryPath, string const & indexPath, StrFn const & strFn) { - m_pDictionary.reset(new sl::SlofDictionary(new FileReader(dictionaryPath))); + FileReader * pDicFileReader = new FileReader(dictionaryPath); + // m_pDictionary takes ownership of pDicFileReader. + m_pDictionary.reset(new sl::SlofDictionary(pDicFileReader)); vector stamp; stamp.push_back(strFn.m_PrimaryCompareId); stamp.push_back(strFn.m_SecondaryCompareId); + stamp.push_back(m_pDictionary->KeyCount()); + stamp.push_back(pDicFileReader->Size()); string const stampPath = indexPath + ".stamp"; bool needIndexBuild = false; try