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

Merge branch 'milestone1' of https://gitlab.eecs.umich.edu/vcday/eecs398-search into milestone1

parents b9a95bef a4133948
No related branches found
No related tags found
No related merge requests found
......@@ -12,13 +12,28 @@ class ISR
public:
//
ISR* DocumentEnd;
virtual Post* Next( );
virtual Post* NextDocument( );
virtual Post* Seek( Location target);
virtual Location GetStartLocation( );
virtual Location GetEndLocation( );
// Returns
virtual Location First( );
//Returns next post of a word given current location
virtual Location Next( );
//Calls seek onto one past the current end doc location
//Return first instance of word at new document
virtual Location NextDocument( );
//Returns first instance of word after target location
virtual Location Seek( Location target);
virtual ISR *GetDocumentISR( );
//Returns the location of the end of the document
virtual Location GetEndDocument( );
Location currentLocation;
};
......
......@@ -17,13 +17,19 @@ class ISROr : publicISR
unsigned NumberOfTerms;
Location GetStartLocation( );//{return nearestStartLocation;}
Location GetEndLocation( );// {return nearestEndLocation;}
Post*Seek( Location target);
Post* 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.
Post*Next( );//{ Do a next on the nearest term, then return// the new nearest match.}
Post*NextDocument( );
//{ Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );}
//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.}
//next on nearest term, return nearest temr
Post* NextDocument( );
//
// { Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );}
private:
unsigned nearestTerm;
// nearStartLocation and nearestEndLocation are// the start and end of the nearestTerm.
......
......@@ -3,3 +3,68 @@
//
#include "ISRWord.h"
void ISRWord::getChunks()
{
//Memory map master index file
//Binary search thru memory map until you find word
//Get list of chunks that you need
//set current chunk
}
Location ISRWord::First()
{
//Go to current chunk
//Look in seek dictionary for chunk (mem map, binary search)
//Have offset into chunk, find post seek to post, return value
//update ISR currentLocation
//set current memory map
//returns offset into corpus
}
//returns next absolute location in corpus
Location ISRWord::Next()
{
//looks at memory map
//if new line ( end of current list for that file
//move to next chunk, update chunk
//find new offset, return first location
//else
//find way to increment to next delta
//return new location
}
Location ISRWord::Seek( Location target )
{
//look thru each chunk
//check if absolute position at offset in chunk is less then chunk,
//check seek lookup table to find if offset+absulte is bigger than target
//if so, set location to that big chunk
//go to next chunk
}
......@@ -13,8 +13,45 @@ class ISRWord : ISR
public:
unsigned GetDocumentCount( );
unsigned GetNumberOfOccurrences( );
virtual Post *GetCurrentPost( );
ISR* DocumentEnd;
// Returns
virtual Location First( );
//Returns next post of a word given current location
virtual Location Next( );
//Calls seek onto one past the current end doc location
//Return first instance of word at new document
virtual Location NextDocument( );
//Returns first instance of word after target location
virtual Location Seek( Location target);
virtual ISR *GetDocumentISR( );
//Returns the location of the end of the document
virtual Location GetEndDocument( );
//Current location of word on disk
Location currentLocation;
char* term;
char* masterIndex;
vector<size_t> listOfChunks;
size_t currentChunk;
char* currentMemMap;
//set member variables to all of the chunks that occur, update current chunk
virtual getChunks();
ISRWord(char * term_in ) : term( term_in )
{
getChunks();
currentLocation = First();
}
};
......@@ -19,14 +19,14 @@ class Post
//What Start / End Location
virtual Location GetStartLocation( );
virtual Location GetEndLocation( );
virtual Attributes GetAttributes( );
virtual Attributes GetAttributes( );
//Returns Next next delta
//TO-DO NICK/ZANE
virtual Post* Next( );
Location currentLocation;
//*why?
virtual ISR* GetIsr( );
//virtual ISR* GetIsr( );
};
......
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