2013-11-28 16:47:57 +01:00
|
|
|
#ifndef INDEX_SEARCHER_HDR
|
|
|
|
#define INDEX_SEARCHER_HDR
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
|
2013-12-06 22:29:25 +01:00
|
|
|
#include "concordia/common/config.hpp"
|
2013-11-29 16:19:49 +01:00
|
|
|
#include "build/libdivsufsort/include/divsufsort.h"
|
2013-11-28 16:47:57 +01:00
|
|
|
#include "concordia/hash_generator.hpp"
|
|
|
|
#include "concordia/concordia_exception.hpp"
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Class for searching the index with a sentence.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class IndexSearcher {
|
|
|
|
public:
|
|
|
|
explicit IndexSearcher();
|
|
|
|
|
|
|
|
/*! Destructor.
|
|
|
|
*/
|
|
|
|
virtual ~IndexSearcher();
|
|
|
|
|
|
|
|
void loadIndex(const string & wordMapFilepath,
|
|
|
|
const string & hashedIndexFilepath,
|
|
|
|
const string & suffixArrayFilepath)
|
|
|
|
throw(ConcordiaException);
|
|
|
|
|
|
|
|
vector<saidx_t> simpleSearch(const string & pattern)
|
|
|
|
throw(ConcordiaException);
|
|
|
|
|
|
|
|
private:
|
|
|
|
boost::shared_ptr<HashGenerator> _hashGenerator;
|
|
|
|
|
|
|
|
sauchar_t * _T;
|
|
|
|
|
|
|
|
saidx_t * _SA;
|
|
|
|
|
2013-12-06 22:29:25 +01:00
|
|
|
saidx_t _n;
|
2013-11-28 16:47:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|