Skip to content
Snippets Groups Projects
Commit 321f73d2 authored by yangni's avatar yangni
Browse files

implementation details including isrs

parent a0714c14
No related branches found
No related tags found
1 merge request!1Add makefile for everyone and tests for the indexer
//
// Created by nick on 2/6/18.
//
#include "IndexStreamReader.h"
IndexStreamReader::IndexStreamReader(string word) {
this->word = word;
}
int IndexStreamReader::first() {
}
int IndexStreamReader::last() {
}
int IndexStreamReader::next(int location) {
}
\ No newline at end of file
//
// Created by nick on 2/6/18.
//
#ifndef EECS398_SEARCH_INDEXSTREAMREADER_H
#define EECS398_SEARCH_INDEXSTREAMREADER_H
#include <iostream>
using namespace std;
class IndexStreamReader {
public:
int first();
int last();
int next(int location);
private:
IndexStreamReader(string word);
string word;
};
#endif //EECS398_SEARCH_INDEXSTREAMREADER_H
#include "Indexer.h"
Indexer::Indexer() {
}
void Index::run() {
while(!pointersToDirectories.empty()) {
hashtable<string, vector<int>>* dicitonary = pointersToDirectories.pop();
for(iterator it : dicitonary) {
open/create it->first file;
for(int num : it->second) {
it->first.append(num + currentidcount)
void Indexer::run() {
while(pointerToDictionaries.Size() != 0) {
unordered_map<string, vector<int>>* dictionary = pointerToDictionaries.Pop();
for(auto it : *dictionary) {
for(auto location : it.second) {
cout << location << endl;
}
save and close it->first
}
}
}
\ No newline at end of file
#include "../ProducerConsumerQueue.h"
#include "../ProducerConsumerQueue.cpp"
#include <unordered_map>
#include <vector>
#include <iostream>
/*
Objective: Pulls small dictionaries from the parser and merges them into the
......@@ -5,9 +11,12 @@ master index.
*/
using namespace std;
class Indexer {
public:
Indexer();
void run();
private:
ProducerConsumerQueue<unordered_map<string, vector<int> >*> pointerToDictionaries;
private:
};
\ No newline at end of file
//
// Created by nick on 2/6/18.
//
#include <iostream>
#include <thread>
#include "Indexer.h"
using namespace std;
int main() {
Indexer indexer = Indexer();
unordered_map<string, vector<int>> test1;
test1["cat"] = { 12, 15, 17 };
test1["dog"] = { 1, 5, 15 };
indexer.pointerToDictionaries.Push(&test1);
indexer.run();
}
\ No newline at end of file
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