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
This commit is contained in:
Andreas Stallinger
2016-06-07 08:49:34 +02:00
parent 53120cf270
commit 6edcd77eb2
25 changed files with 602 additions and 258 deletions
@@ -0,0 +1,45 @@
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include <limits>
#include "utility/utility.h"
#include "utility/logging/logging.h"
void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
{
if( file.empty() )
{
LOG_ERROR("empty file not added to fulltextsearch index");
}
if ( file.size() >= std::numeric_limits<int>::max() )
{
LOG_ERROR("file too big not added to fulltextsearch index");
}
FullTextSearchFile fts_file(fileId, SuffixArray(file));
m_files.push_back(fts_file);
}
std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::string& term) const
{
std::vector<FullTextSearchResult> ret;
FullTextSearchResult hit;
for (auto f : m_files)
{
hit.fileId = f.fileId;
hit.positions = f.array.searchForTerm(term);
ret.push_back(hit);
}
return ret;
}
size_t FullTextSearchIndex::fileCount() const
{
return m_files.size();
}
void FullTextSearchIndex::clear()
{
m_files.clear();
}