Skip to content
Snippets Groups Projects
Commit 0ad12141 authored by jsclose's avatar jsclose
Browse files

fixed git issues

parents b6449ede 971ccea7
No related branches found
No related tags found
1 merge request!9Website
......@@ -157,7 +157,24 @@ add_executable(URLTEST
)
add_executable(search-engine search.cpp query/Searcher.cpp)
add_executable(search-engine
search.cpp
query/Searcher.cpp
util/DataStructureLib/tuple.cpp
util/stringProcessing.cpp
util/Stemmer.cpp
util/util.cpp
constraintSolver/ISRContainer.cpp
constraintSolver/ISR.h
query/Ranker/Ranker.cpp
query/Ranker/Site.cpp
query/Ranker/Scorer.cpp
query/queryLanguage/QueryParser.cpp
constraintSolver/ISREndDoc.cpp
constraintSolver/ISRWord.cpp
constraintSolver/ISRAnd.cpp
constraintSolver/ISROr.cpp)
add_executable(ISRWord-tests
util/util.cpp
......@@ -223,7 +240,7 @@ add_executable(DataStructures-HashTable-tests
DataStructures/HashTable/HashTable.h
DataStructures/HashTable/HashTableTests.cpp)
add_executable(DataStructures-DiskHashTable-tests
add_executable(DataStructures-q-DiskHashTable-tests
DataStructures/DiskHashTable/DiskHashTable.h
DataStructures/DiskHashTable/DiskHashTableTests.cpp)
......
......@@ -28,7 +28,8 @@ ISR * ISRContainer::recurviseCompile( Tuple * root )
if( root->Type == WordTupleType )
{
string currentTerm;
string currentTerm = root->object.text;
terms.push_back( currentTerm );
return new ISRWord( currentTerm );
}
......@@ -55,27 +56,11 @@ void ISRContainer::Solve( )
Location BeginningfDocument = Contained->GetISRToBeginningOfDocument( );
PassToRanker( BeginningfDocument );
//PassToRanker( BeginningfDocument );
Contained->NextDocument( );
/*
* beg = GetBeginning of Doc
* Pass Terms to ranker
*
* vector<words>
*
* Ranker:
* for term in terms
* IsrWord word = new ISR(term)
* Term.seek(beg)
* words.push(word)
* rank(words)
*
* NextDocument()
*/
}
return;
}
......@@ -83,7 +68,7 @@ void ISRContainer::PassToRanker( Location docBeginning )
{
vector<ISRWord* > toRanker;
for ( auto term : Terms )
for ( auto term : terms )
{
ISRWord * isrWord = new ISRWord ( term ) ;
......@@ -92,6 +77,7 @@ void ISRContainer::PassToRanker( Location docBeginning )
}
ranker.rank ( toRanker )
//ranker.rank( toRanker );
}
......@@ -16,21 +16,21 @@ using namespace std;
void Searcher::search ( )
{
if (*CompleteQuery == "-quit" ||*CompleteQuery == "-q" )
if (CompleteQuery == "-quit" ||CompleteQuery == "-q" )
{
cout << "Thank you for using C++lue search engine" << endl;
exit( 0 );
}
else if ( *CompleteQuery == "-help")
else if ( CompleteQuery == "-help")
{
cout << "Manual" << endl;
return;
}
else
{
queryParser.parse(*CompleteQuery);
container->compile( queryParser );
container->solve( );
queryParser.parse(CompleteQuery);
ISRContainer container = ISRContainer( queryParser.queryTree );
container.Solve( );
......@@ -50,7 +50,7 @@ void Searcher::search ( )
*
*/
void QueryParser::printResults ( )
void Searcher::printResults ( )
{
cout << " Generated XXX results in about XXX seconds " << endl;
......
......@@ -2,8 +2,8 @@
// Created by Jake Close on 3/7/18.
//
#include "/query/queryLanguage/QueryParser.h"
#include "/constraintSolver/ISRContainer.h"
#include "../query/queryLanguage/QueryParser.h"
#include "../constraintSolver/ISRContainer.h"
#pragma once
using namespace std;
......@@ -12,17 +12,21 @@ class Searcher
{
public:
Searcher ( string *query_in ) : CompleteQuery( query_in )
{ };
Searcher ( string query_in ) : CompleteQuery( query_in )
{
};
void search ( );
void printResults ( );
private:
string *CompleteQuery;
string CompleteQuery;
QueryParser queryParser;
ISRContainer* container;
//ISRContainer container;
};
......
......@@ -4,6 +4,7 @@
#include "QueryParser.h"
#include<unordered_set>
//#include "../../util/stringProcessing.h"
#include<iostream>
/***
......@@ -14,18 +15,28 @@
*
*
*/
void removeWhitespace(string &str)
{
str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
}
/***
*
* Returns a token of the next word in the query, past the given index
* @param index
* @return
*/
Token QueryParser::FindNextToken( int &index ){
//TODO remove this when you add new ISR
unordered_set<char> stopChars;
stopChars.insert(' ');
int size = 1;
int start = index;
//vector<string> words = splitStr( query , ' ', 0);
//string text = words [ start ] ;
//++index;
while(start + size < query.size())
......@@ -41,19 +52,21 @@ Token QueryParser::FindNextToken( int &index ){
++size;
index = start + size;
string text = query.substr ( start, size );
removeWhitespace(text);
if( MatchOR ( text ) )
return Token( "-OR-" );
return Token( text );
}
else if ( stopChars.count( query[ start + size ] ) > 0)
{
while( query[start] == ' ')
{
++start;
}
//while( query[start] == ' ')
// {
// ++start;
// }
index = start + size;
string text = query.substr ( start, size );
cout << "horse" << text;
removeWhitespace(text);
return Token( text );
}
......@@ -63,8 +76,11 @@ Token QueryParser::FindNextToken( int &index ){
}
}
index = start + size;
string text = query.substr ( start, size );
cout << "horsey: " << text;
removeWhitespace(text);
return Token( text );
}
......
......@@ -13,9 +13,17 @@ int main()
string query = "moment life";
string OR = "bike cycle ";
QueryParser parser;
parser.parse( query );
parser.parse( "moment" );
Token orParentToken = Token("-OR-");
Token life = Token("life");
Tuple* lifeTuple = new Tuple( life );
parser.queryTree->Next.push_back( lifeTuple );
Token orParentToken = Token("-And-");
Tuple * orparent = new Tuple( orParentToken );
Token bike = Token("bike");
......
No preview for this file type
......@@ -29,11 +29,14 @@ int main( int argc, char *argv[] )
while ( getline( cin, q ) && !q.empty( ))
{
QueryParser *query = new QueryParser( q.c_str( ));
query->search( );
query->printResults( );
Searcher searchEngine( q );
cout << "Results" << endl;
searchEngine.search( );
//query->printResults( );
cout << "Please enter another search " << endl;
}
}
......
No preview for this file type
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