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 @@ ...@@ -15,6 +15,8 @@
#include <limits> #include <limits>
#include "ISREndDoc.h" #include "ISREndDoc.h"
#define pathToIndex "/build/"
typedef size_t Location; // Location 0 is the null location. typedef size_t Location; // Location 0 is the null location.
const Location MAX_Location = std::numeric_limits<unsigned>::max(); const Location MAX_Location = std::numeric_limits<unsigned>::max();
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "ISRWord.h" #include "ISRWord.h"
#define pathToIndex = "build"
size_t FileSize(int f) { size_t FileSize(int f) {
struct stat fileInfo; struct stat fileInfo;
fstat( f, &fileInfo); fstat( f, &fileInfo);
...@@ -20,7 +19,7 @@ ISRWord::ISRWord ( char *word ) { ...@@ -20,7 +19,7 @@ ISRWord::ISRWord ( char *word ) {
} }
void ISRWord::getChunks() { 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 value = diskHashTable.find(term);
string chunkInput = ""; string chunkInput = "";
for(char val : value) { for(char val : value) {
...@@ -51,12 +50,12 @@ Location ISRWord::First ( ) ...@@ -51,12 +50,12 @@ Location ISRWord::First ( )
} }
string currentChunkSeekFileLocation = string currentChunkSeekFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) + util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
"-seek.txt"; "-seek.txt";
MMDiskHashTable currentChunkSeekFileHashTable = MMDiskHashTable(currentChunkSeekFileLocation, 30, 8); MMDiskHashTable currentChunkSeekFileHashTable = MMDiskHashTable(currentChunkSeekFileLocation, 30, 8);
string loc = currentChunkSeekFileHashTable.find(term); string loc = currentChunkSeekFileHashTable.find(term);
string currentChunkFileLocation = string currentChunkFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) + util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
".txt"; ".txt";
int currentChunkFile = open( currentChunkFileLocation.c_str( ), O_RDONLY ); int currentChunkFile = open( currentChunkFileLocation.c_str( ), O_RDONLY );
ssize_t currentChunkFileSize = FileSize( currentChunkFile ); ssize_t currentChunkFileSize = FileSize( currentChunkFile );
...@@ -118,7 +117,7 @@ size_t ISRWord::getFrequency() { ...@@ -118,7 +117,7 @@ size_t ISRWord::getFrequency() {
void ISRWord::getWordSeek() { void ISRWord::getWordSeek() {
string currentChunkWordSeekFileLocation = string currentChunkWordSeekFileLocation =
util::GetCurrentWorkingDir( ) + "/constraintSolver/index-test-files/twitter/" + to_string( listOfChunks[ currentChunk ] ) + util::GetCurrentWorkingDir( ) + pathToIndex + to_string( listOfChunks[ currentChunk ] ) +
"-wordseek.txt"; "-wordseek.txt";
MMDiskHashTable wordSeek = MMDiskHashTable(currentChunkWordSeekFileLocation, 30, 168); MMDiskHashTable wordSeek = MMDiskHashTable(currentChunkWordSeekFileLocation, 30, 168);
string result = wordSeek.find(term); string result = wordSeek.find(term);
...@@ -156,7 +155,7 @@ Location ISRWord::Seek( Location target ) { ...@@ -156,7 +155,7 @@ Location ISRWord::Seek( Location target ) {
if(entry.realLocation < target) { if(entry.realLocation < target) {
best = entry; best = entry;
} else { } 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); int currentChunkFile = open(currentChunkFileLocation.c_str(), O_RDONLY);
ssize_t currentChunkFileSize = FileSize(currentChunkFile); ssize_t currentChunkFileSize = FileSize(currentChunkFile);
currentMemMap = (char*) mmap(nullptr, currentChunkFileSize, PROT_READ, MAP_PRIVATE, currentChunkFile, 0); currentMemMap = (char*) mmap(nullptr, currentChunkFileSize, PROT_READ, MAP_PRIVATE, currentChunkFile, 0);
......
...@@ -13,9 +13,9 @@ using namespace std; ...@@ -13,9 +13,9 @@ using namespace std;
int main ( ) int main ( )
{ {
char* query = "iphone"; //char* query = "iphone";
clock_t start = clock(); clock_t start = clock();
ISRWord queryWord("clock"); ISRWord queryWord("world");
ISREndDoc endDocs; ISREndDoc endDocs;
vector<size_t> locations; vector<size_t> locations;
vector<DocumentEnding> docEnds; 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