Files
Sourcetrail/src/lib/data/fulltextsearch/SuffixArray.h
T
Andreas Stallinger 6edcd77eb2 logic: fulltextsearch with suffixarray
* delete test.sqlite in storagetestsuite in desstructor
* remove new and delete from suffixarray
* case sensitive fts
* fixed fulltext results annotated like errors
* lazy suffix array building
* fulltextsearch folder added
* go back too branch without _publish
* suffixarray working
* logic: Improved code view performance
2016-06-07 08:49:34 +02:00

37 lines
700 B
C++

#ifndef SUFFIX_ARRAY_H
#define SUFFIX_ARRAY_H
#include <vector>
#include <string>
#include <iostream>
class SuffixArray
{
public:
SuffixArray(const std::string& text);
std::vector<int> searchForTerm(const std::string& searchTerm) const;
static int cmp(struct suffix a, struct suffix b);
void printArray() const;
void printLCP() const;
private:
template <typename T>
void printArr(std::vector<T>arr) const
{
for (size_t i = 0; i < arr.size(); i++)
{
std::cout << arr[i] << " ";
}
std::cout << std::endl;
}
std::vector<int> buildLCP();
std::vector<int> buildSuffixArray();
std::vector<int> m_array;
std::vector<int> m_lcp;
std::string m_text;
};
#endif // SUFFIX_ARRAY_H