Switch to unified view

a/src/rcldb/stemdb.h b/src/rcldb/stemdb.h
...
...
53
#include <string>
53
#include <string>
54
54
55
#include <xapian.h>
55
#include <xapian.h>
56
56
57
#include "synfamily.h"
57
#include "synfamily.h"
58
#include "unacpp.h"
58
59
59
namespace Rcl {
60
namespace Rcl {
60
61
62
/* A stemming functor for using with XapComputableSynFamMember */
63
class SynTermTransStem : public SynTermTrans {
64
public:
65
    SynTermTransStem(const std::string& lang)
66
  : m_stemmer(lang), m_lang(lang)
67
    {
68
    }
69
    virtual std::string operator()(const std::string& in)
70
    {
71
  string out = m_stemmer(in);
72
  LOGDEB2(("SynTermTransStem(%s): in [%s] out [%s]\n", m_lang.c_str(),
73
       in.c_str(), out.c_str()));
74
  return out;
75
    }
76
    Xapian::Stem m_stemmer;
77
    std::string m_lang;
78
};
79
80
/** Stemdb is a bit special as a SynFamily as we may want to expand for one
81
 * or several members (languages) */
61
class StemDb : public XapSynFamily {
82
class StemDb : public XapSynFamily {
62
public:
83
public:
63
    StemDb(Xapian::Database& xdb)
84
    StemDb(Xapian::Database& xdb)
64
    : XapSynFamily(xdb, synFamStem)
85
    : XapSynFamily(xdb, synFamStem)
65
    {
86
    {
66
    }
87
    }
67
88
68
    /** Expand for a number of languages */
89
    /** Expand for a number of languages */
69
    bool stemExpand(const std::string& langs,
90
    bool stemExpand(const std::string& langs,
70
             const std::string& term,
91
            const std::string& term,
71
             std::vector<std::string>& result);
92
            std::vector<std::string>& result);
72
private:
73
    /** Compute stem and call synExpand() */
74
    bool expandOne(const std::string& lang,
75
         const std::string& term,
76
         std::vector<std::string>& result);
77
};
93
};
78
79
extern bool createExpansionDbs(Xapian::WritableDatabase& wdb, 
80
                 const std::vector<std::string>& langs);
81
94
82
}
95
}
83
96
84
#endif /* _STEMDB_H_INCLUDED_ */
97
#endif /* _STEMDB_H_INCLUDED_ */