Skip to content
Snippets Groups Projects
Commit 6fe0df4d authored by jsclose's avatar jsclose
Browse files

trying to get isr test to work with wash post

parent 3f01f443
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -15,6 +15,8 @@
#include <limits>
#include "ISREndDoc.h"
#define pathToIndex "/build/"
typedef size_t Location; // Location 0 is the null location.
const Location MAX_Location = std::numeric_limits<unsigned>::max();
......
......@@ -3,7 +3,6 @@
#include "ISRWord.h"
#define pathToIndex = "build"
size_t FileSize(int f) {
struct stat fileInfo;
fstat( f, &fileInfo);
......@@ -20,7 +19,7 @@ ISRWord::ISRWord ( char *word ) {
}
void ISRWord::getChunks() {
MMDiskHashTable diskHashTable(util::GetCurrentWorkingDir() + "/constraintSolver/index-test-files/twitter/master.txt", 30, 168);
MMDiskHashTable diskHashTable(util::GetCurrentWorkingDir() + pathToIndex + "master.txt" , 30, 168);
string value = diskHashTable.find(term);
string chunkInput = "";
for(char val : value) {
......@@ -51,12 +50,12 @@ Location ISRWord::First ( )
}
string currentChunkSeekFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) +
util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
"-seek.txt";
MMDiskHashTable currentChunkSeekFileHashTable = MMDiskHashTable(currentChunkSeekFileLocation, 30, 8);
string loc = currentChunkSeekFileHashTable.find(term);
string currentChunkFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) +
util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
".txt";
int currentChunkFile = open( currentChunkFileLocation.c_str( ), O_RDONLY );
ssize_t currentChunkFileSize = FileSize( currentChunkFile );
......@@ -118,7 +117,7 @@ size_t ISRWord::getFrequency() {
void ISRWord::getWordSeek() {
string currentChunkWordSeekFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) +
util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
"-wordseek.txt";
MMDiskHashTable wordSeek = MMDiskHashTable(currentChunkWordSeekFileLocation, 30, 168);
string result = wordSeek.find(term);
......@@ -156,7 +155,7 @@ Location ISRWord::Seek( Location target ) {
if(entry.realLocation < target) {
best = entry;
} else {
string currentChunkFileLocation = util::GetCurrentWorkingDir() + "/constraintSolver/index-test-files/twitter/" + to_string(listOfChunks[currentChunk]) + ".txt";
string currentChunkFileLocation = util::GetCurrentWorkingDir() + pathToIndex + to_string(listOfChunks[currentChunk]) + ".txt";
int currentChunkFile = open(currentChunkFileLocation.c_str(), O_RDONLY);
ssize_t currentChunkFileSize = FileSize(currentChunkFile);
currentMemMap = (char*) mmap(nullptr, currentChunkFileSize, PROT_READ, MAP_PRIVATE, currentChunkFile, 0);
......
......@@ -13,9 +13,9 @@ using namespace std;
int main ( )
{
char* query = "iphone";
//char* query = "iphone";
clock_t start = clock();
ISRWord queryWord("clock");
ISRWord queryWord("world");
ISREndDoc endDocs;
vector<size_t> locations;
vector<DocumentEnding> docEnds;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment