From 7c04b359e9fcf9f75bd88959f93e4b90574e3150 Mon Sep 17 00:00:00 2001 From: Nicholas Yang <parablank@gmail.com> Date: Tue, 13 Mar 2018 18:30:13 -0400 Subject: [PATCH] no need for words in our index /w a seek dictionary --- indexer/Indexer.cpp | 6 +++--- indexer/SeekFileTests.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indexer/Indexer.cpp b/indexer/Indexer.cpp index e573a71..10cf494 100644 --- a/indexer/Indexer.cpp +++ b/indexer/Indexer.cpp @@ -85,9 +85,9 @@ void Indexer::save() { } else { seeker[word.first] = seekOffset; } - string wordBreak = word.first + "\n"; - write(file, wordBreak.c_str(), strlen(wordBreak.c_str())); - seekOffset += strlen(wordBreak.c_str()); +// string wordBreak = word.first + "\n"; +// write(file, wordBreak.c_str(), strlen(wordBreak.c_str())); +// seekOffset += strlen(wordBreak.c_str()); for(auto location : word.second) { string locationSpace = to_string(location) + " "; write(file, locationSpace.c_str(), strlen(locationSpace.c_str())); diff --git a/indexer/SeekFileTests.cpp b/indexer/SeekFileTests.cpp index 8493a25..ba0ba93 100644 --- a/indexer/SeekFileTests.cpp +++ b/indexer/SeekFileTests.cpp @@ -10,9 +10,9 @@ using namespace std; int main() { int index1 = open("index0.txt", O_CREAT|O_RDWR, S_IRWXU); - lseek(index1, 129545, SEEK_SET); + lseek(index1, 129522, SEEK_SET); char buffer[10]; - if(read(index1, buffer, 20) != 20) { + if(read(index1, buffer, 10) != 10) { cout << "ERROR" << endl; } cout << buffer << endl; -- GitLab