VIBE v5.1.6
Search Engine
|
Classes | |
class | Score |
Public Member Functions | |
InvertedIndex () | |
Set< String > | getWords () |
Map< String, Integer > | getCounts () |
Set< Integer > | getPositions (String word, String location) |
Set< String > | getLocations (String word) |
boolean | add (String stem, String path, int location) |
boolean | addAll (String path, Collection< String > stems) |
boolean | addIndex (InvertedIndex other) |
boolean | isEmpty () |
int | size () |
int | sizeOfCounts () |
int | numOfLocations (String word) |
int | numOfPositions (String word, String location) |
boolean | hasWord (String word) |
boolean | hasLocation (String word, String location) |
boolean | hasPosition (String word, String location, int position) |
boolean | hasCount (String location) |
ArrayList< Score > | search (Set< String > queries, boolean partial) |
ArrayList< Score > | exactSearch (Set< String > queries) |
ArrayList< Score > | partialSearch (Set< String > queries) |
void | toJson (Path output) throws IOException |
String | toString () |
Inverted Index Data Structure.
edu.usfca.cs272.InvertedIndex.InvertedIndex | ( | ) |
Creates a new inverted index.
boolean edu.usfca.cs272.InvertedIndex.add | ( | String | stem, |
String | path, | ||
int | location ) |
adds a stem to the index. updates the count after adding the stem to the index.
stem | word stem |
path | file path |
location | index in stemList |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.addAll | ( | String | path, |
Collection< String > | stems ) |
Add a collection of stems to Index.
path | Path of file. |
stems | Collection of stems |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.addIndex | ( | InvertedIndex | other | ) |
Copies data from another inverted index into this index.
other | a different inverted index |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
ArrayList< Score > edu.usfca.cs272.InvertedIndex.exactSearch | ( | Set< String > | queries | ) |
Performs exact search on a set of queries
queries | set of queries. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
Map< String, Integer > edu.usfca.cs272.InvertedIndex.getCounts | ( | ) |
Returns unmodifiable map of files and their stem counts.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
Set< String > edu.usfca.cs272.InvertedIndex.getLocations | ( | String | word | ) |
returns the locations in which a word occurs
word | stem to be searched |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
Set< Integer > edu.usfca.cs272.InvertedIndex.getPositions | ( | String | word, |
String | location ) |
Returns unmodifiable map where key is file path value is location of word.
word | key in the index. |
location | the file in which word is located. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
Set< String > edu.usfca.cs272.InvertedIndex.getWords | ( | ) |
Returns unmodifiable set of keys in the index.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.hasCount | ( | String | location | ) |
checks if stem counts for a location is present.
location | path of file. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.hasLocation | ( | String | word, |
String | location ) |
checks if the index has a location for the word.
word | stem in the index. |
location | location of the stem. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.hasPosition | ( | String | word, |
String | location, | ||
int | position ) |
Checks to see if a word is present in location at specified position
word | stem to be checked |
location | file path |
position | position in file to be checked. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.hasWord | ( | String | word | ) |
checks if word is in the index or not.
word | stem to be looked up |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
boolean edu.usfca.cs272.InvertedIndex.isEmpty | ( | ) |
Returns true if index is empty.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
int edu.usfca.cs272.InvertedIndex.numOfLocations | ( | String | word | ) |
Returns the number of locations where a word occurs.
word | stem to be searched. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
int edu.usfca.cs272.InvertedIndex.numOfPositions | ( | String | word, |
String | location ) |
Returns the number of positions where a word occurs in a location.
word | stem to be searched. |
location | file path. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
ArrayList< Score > edu.usfca.cs272.InvertedIndex.partialSearch | ( | Set< String > | queries | ) |
Performs partial search on index
queries | set of queries |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
ArrayList< Score > edu.usfca.cs272.InvertedIndex.search | ( | Set< String > | queries, |
boolean | partial ) |
Method to determine if partial or exact search needs to be performed.
queries | set of stems in the query. |
partial | partial flag. |
int edu.usfca.cs272.InvertedIndex.size | ( | ) |
Returns the number of stems in the index.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
int edu.usfca.cs272.InvertedIndex.sizeOfCounts | ( | ) |
Returns the number of locations for which there is a stem count.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
void edu.usfca.cs272.InvertedIndex.toJson | ( | Path | output | ) | throws IOException |
writes index in pretty Json to output file.
output | Path of output file. |
IOException | if path is invalid. |
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.
String edu.usfca.cs272.InvertedIndex.toString | ( | ) |
Returns Inverted Index in pretty Json.
Reimplemented in edu.usfca.cs272.ThreadSafeInvertedIndex.