Skip to content
Snippets Groups Projects
Commit 6b9eced8 authored by vcday's avatar vcday
Browse files

url q

parents e18149f5 b181bd3f
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -16,8 +16,8 @@ add_executable(crawler-parser-test ...@@ -16,8 +16,8 @@ add_executable(crawler-parser-test
crawler/LocalReader.h crawler/LocalReader.h
shared/Document.cpp shared/Document.cpp
parser/Parser.cpp parser/Parser.cpp
util/Tokenizer.cpp
util/Stemmer.cpp util/Stemmer.cpp
util/Tokenizer.cpp
util/stringProcessing.cpp) util/stringProcessing.cpp)
...@@ -53,7 +53,7 @@ add_executable(URLTEST shared/url.h shared/urlTest.cpp) ...@@ -53,7 +53,7 @@ add_executable(URLTEST shared/url.h shared/urlTest.cpp)
add_executable(search-engine search.cpp query/Query.cpp) add_executable(search-engine search.cpp query/Query.cpp)
add_executable(ISRWord-tests constraintSolver/tests/ISRWordTests.cpp) add_executable(ISRWord-tests util/util.cpp constraintSolver/ISRWord.cpp constraintSolver/tests/ISRWordTests.cpp )
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
......
File deleted
File deleted
...@@ -3,3 +3,68 @@ ...@@ -3,3 +3,68 @@
// //
#include "ISROr.h" #include "ISROr.h"
Location ISROr::GetStartLocation( )
{
return nearestStartLocation;
}
Location ISROr::GetEndLocation( )
{
return nearestEndLocation;
}
Location ISROr::Seek( Location target )
{
// Seek all the ISRs to the first occurrence beginning at// the target location. Return null if there is no match.
// The document is the document containing the nearest term.
//seek past target locations,
//seek all terms in or past starting location, take the ones that nears
//the document that the nearest term is in is the document ur in
//updates private members
}
/*
Returns the location of the next document that is a match
*/
ISR* ISROr::Next()
{
Location nearestEnd = this->nearestTerm->GetEndDocument();
while(*Terms)
{
Location newSeekLocation = *Terms->Seek(nearestEnd + 1);
if(newSeekLocation < nearestStartLocation)
{
nearestStartLocation = newSeekLocation;
nearestTerm = *Term;
}
*Terms++;
}
return this->nearestTerm->GetDocumentISR();
}
ISR* ISROR::GetCurrentEndDoc( ){
return this->nearestTerm->GetDocumentISR();
}
...@@ -15,23 +15,46 @@ class ISROr : publicISR ...@@ -15,23 +15,46 @@ class ISROr : publicISR
ISR ** Terms; ISR ** Terms;
unsigned NumberOfTerms; unsigned NumberOfTerms;
Location GetStartLocation( );//{return nearestStartLocation;} Location GetStartLocation( );
Location GetEndLocation( );// {return nearestEndLocation;} Location GetEndLocation( );
Post* Seek( Location target); Location Seek( Location target);
// Seek all the ISRs to the first occurrence beginning at// the target location. Return null if there is no match. ISR* GetCurrentEndDoc( );
// The document is the document containing the nearest term. Location Next( );
//seek past target locations,
//seek all terms in or past starting location, take the ones that nears
//the document that the nearest term is in is the document ur in
//updates private members
Post* Next( );
//{ Do a next on the nearest term, then return// the new nearest match.} //{ Do a next on the nearest term, then return// the new nearest match.}
//next on nearest term, return nearest temr //next on nearest term, return nearest temr
Post* NextDocument( );
Location NextDocument( );
// //
// { Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );} // { Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );}
ISROr(ISR ** InputTerms) : Terms(InputTerms) {
ISR* currentTerm = *InputTerms;
While( *currentTerm )
{
currentTerm->First();
Location currentLocation = currentTerm->currentLocation;
if(currentLocation < nearestStartLocation )
{
nearestTerm = currentTerm;
nearestStartLocation = currentLocation;
}
if(currentLocation > nearestEndLocation)
{
nearestEndLocation = currentLocation;
}
++NumberOfTerms;
*currentTerm++;
}
}
private: private:
unsigned nearestTerm; ISR* nearestTerm;
// nearStartLocation and nearestEndLocation are// the start and end of the nearestTerm. // nearStartLocation and nearestEndLocation are// the start and end of the nearestTerm.
Location nearestStartLocation, nearestEndLocation; Location nearestStartLocation, nearestEndLocation;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "ISRWord.h" #include "ISRWord.h"
using namespace std;
ISRWord::ISRWord(char* word) : term(word) { ISRWord::ISRWord(char* word) : term(word) {
getChunks(); getChunks();
currentChunk = 0; currentChunk = 0;
...@@ -15,7 +17,10 @@ vector<size_t> ISRWord::getSeekContents(string fileName) { ...@@ -15,7 +17,10 @@ vector<size_t> ISRWord::getSeekContents(string fileName) {
int file = open(fileName.c_str(), O_RDONLY); int file = open(fileName.c_str(), O_RDONLY);
ssize_t fileSize = FileSize(file); ssize_t fileSize = FileSize(file);
vector<size_t> contents; vector<size_t> contents;
char* memMap = (char*) mmap(nullptr, fileSize, PROT_READ, MAP_PRIVATE, file, 0); char* memMap = (char*) mmap(nullptr, fileSize, PROT_READ, MAP_PRIVATE, file, 0);
// char* memMap = util::getFileMap(fileName);
string word = ""; string word = "";
bool midWord = false; bool midWord = false;
bool midFind = false; bool midFind = false;
...@@ -50,6 +55,7 @@ vector<size_t> ISRWord::getSeekContents(string fileName) { ...@@ -50,6 +55,7 @@ vector<size_t> ISRWord::getSeekContents(string fileName) {
} }
void ISRWord::getChunks() { void ISRWord::getChunks() {
listOfChunks = getSeekContents("index-test-files/twitter/index-master.txt"); listOfChunks = getSeekContents("index-test-files/twitter/index-master.txt");
// int chunkFile = open("index-test-files/twitter/index-master.txt", O_RDONLY); // int chunkFile = open("index-test-files/twitter/index-master.txt", O_RDONLY);
// ssize_t chunkFileSize = FileSize(chunkFile); // ssize_t chunkFileSize = FileSize(chunkFile);
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
//#include "../util/util.h"
size_t FileSize(int f) { size_t FileSize(int f) {
struct stat fileInfo; struct stat fileInfo;
fstat( f, &fileInfo); fstat( f, &fileInfo);
...@@ -52,6 +55,8 @@ public: ...@@ -52,6 +55,8 @@ public:
//set member variables to all of the chunks that occur, update current chunk //set member variables to all of the chunks that occur, update current chunk
void getChunks(); void getChunks();
private: private:
}; };
......
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
#include "../ISRWord.h" #include "../ISRWord.h"
#include "../ISRWord.cpp" #include "../ISRWord.cpp"
using namespace std; using namespace std;
int main() { int main() {
ISRWord word = ISRWord("hello"); char* w = new char [ 10 ];
strcpy(w, "hello");
ISRWord word = ISRWord(w);
while(1) { while(1) {
cout << word.next() << endl; cout << word.next() << endl;
} }
......
No preview for this file type
...@@ -16,7 +16,7 @@ class Crawler ...@@ -16,7 +16,7 @@ class Crawler
{ {
public: public:
Crawler( string mode_in, ProducerConsumerQueue < string > *url_q_in ) Crawler( string mode_in, ProducerConsumerQueue < ParsedUrl > *url_q_in )
: mode( mode_in ), urlFrontier( url_q_in ) : mode( mode_in ), urlFrontier( url_q_in )
{ }; { };
...@@ -30,7 +30,7 @@ public: ...@@ -30,7 +30,7 @@ public:
private: private:
vector < Spider * > spiders; vector < Spider * > spiders;
ProducerConsumerQueue < string > *urlFrontier; ProducerConsumerQueue < ParsedUrl > *urlFrontier;
//CrawlerStatistics housekeeper; //CrawlerStatistics housekeeper;
string mode; string mode;
......
...@@ -30,7 +30,7 @@ size_t Spider::hash(const char * s){ ...@@ -30,7 +30,7 @@ size_t Spider::hash(const char * s){
} }
string Spider::getUrl() ParsedUrl Spider::getUrl()
{ {
return urlFrontier->Pop( ); return urlFrontier->Pop( );
} }
...@@ -46,9 +46,9 @@ void Spider::FuncToRun() ...@@ -46,9 +46,9 @@ void Spider::FuncToRun()
{ {
string stringUrl = getUrl( ); //get url from url frontier // ParsedUrl stringUrl = getUrl( ); //get url from url frontier
char *fileMap; char *fileMap;
ParsedUrl currentUrl = ParsedUrl(stringUrl); ParsedUrl currentUrl = getUrl();
//url has not seen before or time since seen is past certain criteria //url has not seen before or time since seen is past certain criteria
if ( shouldURLbeCrawled( currentUrl )) if ( shouldURLbeCrawled( currentUrl ))
{ {
......
...@@ -23,7 +23,7 @@ class Spider : public ThreadClass ...@@ -23,7 +23,7 @@ class Spider : public ThreadClass
public: public:
Spider( string mode_in, ProducerConsumerQueue < string > *url_q_in, Spider( string mode_in, ProducerConsumerQueue < ParsedUrl > *url_q_in,
unordered_map < string, int > *doc_map_lookup_in ) unordered_map < string, int > *doc_map_lookup_in )
: mode( mode_in ), urlFrontier( url_q_in ), docMapLookup( doc_map_lookup_in ), parser( url_q_in) : mode( mode_in ), urlFrontier( url_q_in ), docMapLookup( doc_map_lookup_in ), parser( url_q_in)
{ {
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
//Takes a url off of the url frontier //Takes a url off of the url frontier
string getUrl(); ParsedUrl getUrl();
virtual void FuncToRun(); virtual void FuncToRun();
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
private: private:
int locationOnDisk; int locationOnDisk;
ProducerConsumerQueue < string > *urlFrontier; ProducerConsumerQueue < ParsedUrl > *urlFrontier;
string mode; string mode;
unordered_map < string, int > *docMapLookup; unordered_map < string, int > *docMapLookup;
Parser parser; Parser parser;
......
...@@ -89,7 +89,7 @@ int main( int argc, char *argv[] ) ...@@ -89,7 +89,7 @@ int main( int argc, char *argv[] )
bool restoreFromLog; bool restoreFromLog;
ProducerConsumerQueue < string > urlFrontier; ProducerConsumerQueue < ParsedUrl > urlFrontier;
cout << "Pushed File\n"; cout << "Pushed File\n";
char *seeds; char *seeds;
...@@ -104,7 +104,8 @@ int main( int argc, char *argv[] ) ...@@ -104,7 +104,8 @@ int main( int argc, char *argv[] )
if ( *seeds == '\n') if ( *seeds == '\n')
{ {
cout << "Pushing to Url Frontier..." << endl; cout << "Pushing to Url Frontier..." << endl;
urlFrontier.Push(testFile); ParsedUrl url = ParsedUrl(testFile);
urlFrontier.Push(url);
testFile = ""; testFile = "";
} }
......
...@@ -111,17 +111,17 @@ depend: ...@@ -111,17 +111,17 @@ depend:
.PHONY : depend .PHONY : depend
#============================================================================= #=============================================================================
# Target rules for targets named URLTEST # Target rules for targets named ISRWord-tests
# Build rule for target. # Build rule for target.
URLTEST: cmake_check_build_system ISRWord-tests: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 URLTEST $(MAKE) -f CMakeFiles/Makefile2 ISRWord-tests
.PHONY : URLTEST .PHONY : ISRWord-tests
# fast build rule for target. # fast build rule for target.
URLTEST/fast: ISRWord-tests/fast:
$(MAKE) -f CMakeFiles/URLTEST.dir/build.make CMakeFiles/URLTEST.dir/build $(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/build
.PHONY : URLTEST/fast .PHONY : ISRWord-tests/fast
#============================================================================= #=============================================================================
# Target rules for targets named StemmerTest # Target rules for targets named StemmerTest
...@@ -137,17 +137,17 @@ StemmerTest/fast: ...@@ -137,17 +137,17 @@ StemmerTest/fast:
.PHONY : StemmerTest/fast .PHONY : StemmerTest/fast
#============================================================================= #=============================================================================
# Target rules for targets named ParserEndToEndTest # Target rules for targets named StringProcessingTest
# Build rule for target. # Build rule for target.
ParserEndToEndTest: cmake_check_build_system StringProcessingTest: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 ParserEndToEndTest $(MAKE) -f CMakeFiles/Makefile2 StringProcessingTest
.PHONY : ParserEndToEndTest .PHONY : StringProcessingTest
# fast build rule for target. # fast build rule for target.
ParserEndToEndTest/fast: StringProcessingTest/fast:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/build $(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/build
.PHONY : ParserEndToEndTest/fast .PHONY : StringProcessingTest/fast
#============================================================================= #=============================================================================
# Target rules for targets named TokenizerTest # Target rules for targets named TokenizerTest
...@@ -163,17 +163,30 @@ TokenizerTest/fast: ...@@ -163,17 +163,30 @@ TokenizerTest/fast:
.PHONY : TokenizerTest/fast .PHONY : TokenizerTest/fast
#============================================================================= #=============================================================================
# Target rules for targets named StringProcessingTest # Target rules for targets named URLTEST
# Build rule for target. # Build rule for target.
StringProcessingTest: cmake_check_build_system URLTEST: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 StringProcessingTest $(MAKE) -f CMakeFiles/Makefile2 URLTEST
.PHONY : StringProcessingTest .PHONY : URLTEST
# fast build rule for target. # fast build rule for target.
StringProcessingTest/fast: URLTEST/fast:
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/build $(MAKE) -f CMakeFiles/URLTEST.dir/build.make CMakeFiles/URLTEST.dir/build
.PHONY : StringProcessingTest/fast .PHONY : URLTEST/fast
#=============================================================================
# Target rules for targets named ParserTest
# Build rule for target.
ParserTest: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 ParserTest
.PHONY : ParserTest
# fast build rule for target.
ParserTest/fast:
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/build
.PHONY : ParserTest/fast
#============================================================================= #=============================================================================
# Target rules for targets named search-engine # Target rules for targets named search-engine
...@@ -201,6 +214,60 @@ crawler-parser-test/fast: ...@@ -201,6 +214,60 @@ crawler-parser-test/fast:
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/build $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/build
.PHONY : crawler-parser-test/fast .PHONY : crawler-parser-test/fast
constraintSolver/ISRWord.o: constraintSolver/ISRWord.cpp.o
.PHONY : constraintSolver/ISRWord.o
# target to build an object file
constraintSolver/ISRWord.cpp.o:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/ISRWord.cpp.o
.PHONY : constraintSolver/ISRWord.cpp.o
constraintSolver/ISRWord.i: constraintSolver/ISRWord.cpp.i
.PHONY : constraintSolver/ISRWord.i
# target to preprocess a source file
constraintSolver/ISRWord.cpp.i:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/ISRWord.cpp.i
.PHONY : constraintSolver/ISRWord.cpp.i
constraintSolver/ISRWord.s: constraintSolver/ISRWord.cpp.s
.PHONY : constraintSolver/ISRWord.s
# target to generate assembly for a file
constraintSolver/ISRWord.cpp.s:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/ISRWord.cpp.s
.PHONY : constraintSolver/ISRWord.cpp.s
constraintSolver/tests/ISRWordTests.o: constraintSolver/tests/ISRWordTests.cpp.o
.PHONY : constraintSolver/tests/ISRWordTests.o
# target to build an object file
constraintSolver/tests/ISRWordTests.cpp.o:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/tests/ISRWordTests.cpp.o
.PHONY : constraintSolver/tests/ISRWordTests.cpp.o
constraintSolver/tests/ISRWordTests.i: constraintSolver/tests/ISRWordTests.cpp.i
.PHONY : constraintSolver/tests/ISRWordTests.i
# target to preprocess a source file
constraintSolver/tests/ISRWordTests.cpp.i:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/tests/ISRWordTests.cpp.i
.PHONY : constraintSolver/tests/ISRWordTests.cpp.i
constraintSolver/tests/ISRWordTests.s: constraintSolver/tests/ISRWordTests.cpp.s
.PHONY : constraintSolver/tests/ISRWordTests.s
# target to generate assembly for a file
constraintSolver/tests/ISRWordTests.cpp.s:
$(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/constraintSolver/tests/ISRWordTests.cpp.s
.PHONY : constraintSolver/tests/ISRWordTests.cpp.s
crawler/SocketReader.o: crawler/SocketReader.cpp.o crawler/SocketReader.o: crawler/SocketReader.cpp.o
.PHONY : crawler/SocketReader.o .PHONY : crawler/SocketReader.o
...@@ -315,7 +382,7 @@ parser/Parser.o: parser/Parser.cpp.o ...@@ -315,7 +382,7 @@ parser/Parser.o: parser/Parser.cpp.o
# target to build an object file # target to build an object file
parser/Parser.cpp.o: parser/Parser.cpp.o:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/Parser.cpp.o $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/Parser.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.o $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.o
.PHONY : parser/Parser.cpp.o .PHONY : parser/Parser.cpp.o
...@@ -325,7 +392,7 @@ parser/Parser.i: parser/Parser.cpp.i ...@@ -325,7 +392,7 @@ parser/Parser.i: parser/Parser.cpp.i
# target to preprocess a source file # target to preprocess a source file
parser/Parser.cpp.i: parser/Parser.cpp.i:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/Parser.cpp.i $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/Parser.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.i $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.i
.PHONY : parser/Parser.cpp.i .PHONY : parser/Parser.cpp.i
...@@ -335,7 +402,7 @@ parser/Parser.s: parser/Parser.cpp.s ...@@ -335,7 +402,7 @@ parser/Parser.s: parser/Parser.cpp.s
# target to generate assembly for a file # target to generate assembly for a file
parser/Parser.cpp.s: parser/Parser.cpp.s:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/Parser.cpp.s $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/Parser.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.s $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/parser/Parser.cpp.s
.PHONY : parser/Parser.cpp.s .PHONY : parser/Parser.cpp.s
...@@ -345,7 +412,7 @@ parser/tests/parserTest.o: parser/tests/parserTest.cpp.o ...@@ -345,7 +412,7 @@ parser/tests/parserTest.o: parser/tests/parserTest.cpp.o
# target to build an object file # target to build an object file
parser/tests/parserTest.cpp.o: parser/tests/parserTest.cpp.o:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/tests/parserTest.cpp.o $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/tests/parserTest.cpp.o
.PHONY : parser/tests/parserTest.cpp.o .PHONY : parser/tests/parserTest.cpp.o
parser/tests/parserTest.i: parser/tests/parserTest.cpp.i parser/tests/parserTest.i: parser/tests/parserTest.cpp.i
...@@ -354,7 +421,7 @@ parser/tests/parserTest.i: parser/tests/parserTest.cpp.i ...@@ -354,7 +421,7 @@ parser/tests/parserTest.i: parser/tests/parserTest.cpp.i
# target to preprocess a source file # target to preprocess a source file
parser/tests/parserTest.cpp.i: parser/tests/parserTest.cpp.i:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/tests/parserTest.cpp.i $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/tests/parserTest.cpp.i
.PHONY : parser/tests/parserTest.cpp.i .PHONY : parser/tests/parserTest.cpp.i
parser/tests/parserTest.s: parser/tests/parserTest.cpp.s parser/tests/parserTest.s: parser/tests/parserTest.cpp.s
...@@ -363,7 +430,7 @@ parser/tests/parserTest.s: parser/tests/parserTest.cpp.s ...@@ -363,7 +430,7 @@ parser/tests/parserTest.s: parser/tests/parserTest.cpp.s
# target to generate assembly for a file # target to generate assembly for a file
parser/tests/parserTest.cpp.s: parser/tests/parserTest.cpp.s:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/parser/tests/parserTest.cpp.s $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/parser/tests/parserTest.cpp.s
.PHONY : parser/tests/parserTest.cpp.s .PHONY : parser/tests/parserTest.cpp.s
query/Query.o: query/Query.cpp.o query/Query.o: query/Query.cpp.o
...@@ -426,7 +493,7 @@ shared/Document.o: shared/Document.cpp.o ...@@ -426,7 +493,7 @@ shared/Document.o: shared/Document.cpp.o
# target to build an object file # target to build an object file
shared/Document.cpp.o: shared/Document.cpp.o:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/shared/Document.cpp.o $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/shared/Document.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.o $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.o
.PHONY : shared/Document.cpp.o .PHONY : shared/Document.cpp.o
...@@ -436,7 +503,7 @@ shared/Document.i: shared/Document.cpp.i ...@@ -436,7 +503,7 @@ shared/Document.i: shared/Document.cpp.i
# target to preprocess a source file # target to preprocess a source file
shared/Document.cpp.i: shared/Document.cpp.i:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/shared/Document.cpp.i $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/shared/Document.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.i $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.i
.PHONY : shared/Document.cpp.i .PHONY : shared/Document.cpp.i
...@@ -446,7 +513,7 @@ shared/Document.s: shared/Document.cpp.s ...@@ -446,7 +513,7 @@ shared/Document.s: shared/Document.cpp.s
# target to generate assembly for a file # target to generate assembly for a file
shared/Document.cpp.s: shared/Document.cpp.s:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/shared/Document.cpp.s $(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/shared/Document.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.s $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/shared/Document.cpp.s
.PHONY : shared/Document.cpp.s .PHONY : shared/Document.cpp.s
...@@ -477,14 +544,88 @@ shared/urlTest.cpp.s: ...@@ -477,14 +544,88 @@ shared/urlTest.cpp.s:
$(MAKE) -f CMakeFiles/URLTEST.dir/build.make CMakeFiles/URLTEST.dir/shared/urlTest.cpp.s $(MAKE) -f CMakeFiles/URLTEST.dir/build.make CMakeFiles/URLTEST.dir/shared/urlTest.cpp.s
.PHONY : shared/urlTest.cpp.s .PHONY : shared/urlTest.cpp.s
util/Stemmer.o: util/Stemmer.cpp.o
.PHONY : util/Stemmer.o
# target to build an object file
util/Stemmer.cpp.o:
$(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/Stemmer.cpp.o
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/Stemmer.cpp.o
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Stemmer.cpp.o
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Stemmer.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Stemmer.cpp.o
.PHONY : util/Stemmer.cpp.o
util/Stemmer.i: util/Stemmer.cpp.i
.PHONY : util/Stemmer.i
# target to preprocess a source file
util/Stemmer.cpp.i:
$(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/Stemmer.cpp.i
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/Stemmer.cpp.i
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Stemmer.cpp.i
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Stemmer.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Stemmer.cpp.i
.PHONY : util/Stemmer.cpp.i
util/Stemmer.s: util/Stemmer.cpp.s
.PHONY : util/Stemmer.s
# target to generate assembly for a file
util/Stemmer.cpp.s:
$(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/Stemmer.cpp.s
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/Stemmer.cpp.s
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Stemmer.cpp.s
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Stemmer.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Stemmer.cpp.s
.PHONY : util/Stemmer.cpp.s
util/Tokenizer.o: util/Tokenizer.cpp.o
.PHONY : util/Tokenizer.o
# target to build an object file
util/Tokenizer.cpp.o:
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Tokenizer.cpp.o
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Tokenizer.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Tokenizer.cpp.o
.PHONY : util/Tokenizer.cpp.o
util/Tokenizer.i: util/Tokenizer.cpp.i
.PHONY : util/Tokenizer.i
# target to preprocess a source file
util/Tokenizer.cpp.i:
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Tokenizer.cpp.i
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Tokenizer.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Tokenizer.cpp.i
.PHONY : util/Tokenizer.cpp.i
util/Tokenizer.s: util/Tokenizer.cpp.s
.PHONY : util/Tokenizer.s
# target to generate assembly for a file
util/Tokenizer.cpp.s:
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/Tokenizer.cpp.s
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/Tokenizer.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/Tokenizer.cpp.s
.PHONY : util/Tokenizer.cpp.s
util/stringProcessing.o: util/stringProcessing.cpp.o util/stringProcessing.o: util/stringProcessing.cpp.o
.PHONY : util/stringProcessing.o .PHONY : util/stringProcessing.o
# target to build an object file # target to build an object file
util/stringProcessing.cpp.o: util/stringProcessing.cpp.o:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/stringProcessing.cpp.o $(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/stringProcessing.cpp.o
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.o $(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.o
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/stringProcessing.cpp.o
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/stringProcessing.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.o $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.o
.PHONY : util/stringProcessing.cpp.o .PHONY : util/stringProcessing.cpp.o
...@@ -494,8 +635,10 @@ util/stringProcessing.i: util/stringProcessing.cpp.i ...@@ -494,8 +635,10 @@ util/stringProcessing.i: util/stringProcessing.cpp.i
# target to preprocess a source file # target to preprocess a source file
util/stringProcessing.cpp.i: util/stringProcessing.cpp.i:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/stringProcessing.cpp.i $(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/stringProcessing.cpp.i
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.i $(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.i
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/stringProcessing.cpp.i
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/stringProcessing.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.i $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.i
.PHONY : util/stringProcessing.cpp.i .PHONY : util/stringProcessing.cpp.i
...@@ -505,8 +648,10 @@ util/stringProcessing.s: util/stringProcessing.cpp.s ...@@ -505,8 +648,10 @@ util/stringProcessing.s: util/stringProcessing.cpp.s
# target to generate assembly for a file # target to generate assembly for a file
util/stringProcessing.cpp.s: util/stringProcessing.cpp.s:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/stringProcessing.cpp.s $(MAKE) -f CMakeFiles/StemmerTest.dir/build.make CMakeFiles/StemmerTest.dir/util/stringProcessing.cpp.s
$(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.s $(MAKE) -f CMakeFiles/StringProcessingTest.dir/build.make CMakeFiles/StringProcessingTest.dir/util/stringProcessing.cpp.s
$(MAKE) -f CMakeFiles/TokenizerTest.dir/build.make CMakeFiles/TokenizerTest.dir/util/stringProcessing.cpp.s
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/stringProcessing.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.s $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/stringProcessing.cpp.s
.PHONY : util/stringProcessing.cpp.s .PHONY : util/stringProcessing.cpp.s
...@@ -597,7 +742,8 @@ util/util.o: util/util.cpp.o ...@@ -597,7 +742,8 @@ util/util.o: util/util.cpp.o
# target to build an object file # target to build an object file
util/util.cpp.o: util/util.cpp.o:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/util.cpp.o $(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/util/util.cpp.o
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/util.cpp.o
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.o $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.o
.PHONY : util/util.cpp.o .PHONY : util/util.cpp.o
...@@ -607,7 +753,8 @@ util/util.i: util/util.cpp.i ...@@ -607,7 +753,8 @@ util/util.i: util/util.cpp.i
# target to preprocess a source file # target to preprocess a source file
util/util.cpp.i: util/util.cpp.i:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/util.cpp.i $(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/util/util.cpp.i
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/util.cpp.i
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.i $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.i
.PHONY : util/util.cpp.i .PHONY : util/util.cpp.i
...@@ -617,7 +764,8 @@ util/util.s: util/util.cpp.s ...@@ -617,7 +764,8 @@ util/util.s: util/util.cpp.s
# target to generate assembly for a file # target to generate assembly for a file
util/util.cpp.s: util/util.cpp.s:
$(MAKE) -f CMakeFiles/ParserEndToEndTest.dir/build.make CMakeFiles/ParserEndToEndTest.dir/util/util.cpp.s $(MAKE) -f CMakeFiles/ISRWord-tests.dir/build.make CMakeFiles/ISRWord-tests.dir/util/util.cpp.s
$(MAKE) -f CMakeFiles/ParserTest.dir/build.make CMakeFiles/ParserTest.dir/util/util.cpp.s
$(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.s $(MAKE) -f CMakeFiles/crawler-parser-test.dir/build.make CMakeFiles/crawler-parser-test.dir/util/util.cpp.s
.PHONY : util/util.cpp.s .PHONY : util/util.cpp.s
...@@ -628,14 +776,21 @@ help: ...@@ -628,14 +776,21 @@ help:
@echo "... clean" @echo "... clean"
@echo "... depend" @echo "... depend"
@echo "... edit_cache" @echo "... edit_cache"
@echo "... URLTEST" @echo "... ISRWord-tests"
@echo "... rebuild_cache" @echo "... rebuild_cache"
@echo "... StemmerTest" @echo "... StemmerTest"
@echo "... ParserEndToEndTest"
@echo "... TokenizerTest"
@echo "... StringProcessingTest" @echo "... StringProcessingTest"
@echo "... TokenizerTest"
@echo "... URLTEST"
@echo "... ParserTest"
@echo "... search-engine" @echo "... search-engine"
@echo "... crawler-parser-test" @echo "... crawler-parser-test"
@echo "... constraintSolver/ISRWord.o"
@echo "... constraintSolver/ISRWord.i"
@echo "... constraintSolver/ISRWord.s"
@echo "... constraintSolver/tests/ISRWordTests.o"
@echo "... constraintSolver/tests/ISRWordTests.i"
@echo "... constraintSolver/tests/ISRWordTests.s"
@echo "... crawler/SocketReader.o" @echo "... crawler/SocketReader.o"
@echo "... crawler/SocketReader.i" @echo "... crawler/SocketReader.i"
@echo "... crawler/SocketReader.s" @echo "... crawler/SocketReader.s"
...@@ -666,6 +821,12 @@ help: ...@@ -666,6 +821,12 @@ help:
@echo "... shared/urlTest.o" @echo "... shared/urlTest.o"
@echo "... shared/urlTest.i" @echo "... shared/urlTest.i"
@echo "... shared/urlTest.s" @echo "... shared/urlTest.s"
@echo "... util/Stemmer.o"
@echo "... util/Stemmer.i"
@echo "... util/Stemmer.s"
@echo "... util/Tokenizer.o"
@echo "... util/Tokenizer.i"
@echo "... util/Tokenizer.s"
@echo "... util/stringProcessing.o" @echo "... util/stringProcessing.o"
@echo "... util/stringProcessing.i" @echo "... util/stringProcessing.i"
@echo "... util/stringProcessing.s" @echo "... util/stringProcessing.s"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Parser Cstor * Parser Cstor
* @param urlFrontierIn * @param urlFrontierIn
*/ */
Parser::Parser ( ProducerConsumerQueue< string > *urlFrontierIn ) Parser::Parser ( ProducerConsumerQueue< ParsedUrl > *urlFrontierIn )
{ {
urlFrontier = urlFrontierIn; urlFrontier = urlFrontierIn;
} }
...@@ -67,7 +67,9 @@ void Parser::parse ( string html, ParsedUrl currentUrl, Tokenizer *tokenizer ) ...@@ -67,7 +67,9 @@ void Parser::parse ( string html, ParsedUrl currentUrl, Tokenizer *tokenizer )
if ( isValid( url ) ) if ( isValid( url ) )
{ {
// TODO ParsedUrl with anchor text // TODO ParsedUrl with anchor text
urlFrontier->Push( url );
ParsedUrl pUrl = ParsedUrl( url );
urlFrontier->Push( pUrl );
cout << url << endl; cout << url << endl;
} }
} }
......
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
* Parser Cstor * Parser Cstor
* @param urlFrontierIn * @param urlFrontierIn
*/ */
Parser ( ProducerConsumerQueue < string > * urlFrontierIn); Parser ( ProducerConsumerQueue < ParsedUrl > * urlFrontierIn);
/** /**
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
private: private:
ProducerConsumerQueue < string >* urlFrontier; ProducerConsumerQueue < ParsedUrl >* urlFrontier;
/** /**
* Parses file * Parses file
......
File deleted
...@@ -27,6 +27,7 @@ namespace util ...@@ -27,6 +27,7 @@ namespace util
return open( fileName.c_str( ), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR ); return open( fileName.c_str( ), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR );
} }
return -1;
} }
......
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