VIBE v5.1.6
Search Engine
|
Public Member Functions | |
ThreadSafeInvertedIndex () | |
Set< String > | getWords () |
Set< Integer > | getPositions (String word, String location) |
Set< String > | getLocations (String word) |
boolean | hasCount (String location) |
boolean | hasLocation (String word, String location) |
boolean | hasPosition (String word, String location, int position) |
Map< String, Integer > | getCounts () |
boolean | add (String stem, String path, int location) |
boolean | addAll (String path, Collection< String > stems) |
boolean | addIndex (InvertedIndex invertedIndex) |
boolean | isEmpty () |
int | size () |
int | sizeOfCounts () |
int | numOfLocations (String word) |
int | numOfPositions (String word, String location) |
boolean | hasWord (String word) |
ArrayList< Score > | exactSearch (Set< String > queries) |
ArrayList< Score > | partialSearch (Set< String > queries) |
void | toJson (Path output) throws IOException |
String | toString () |
Public Member Functions inherited from edu.usfca.cs272.InvertedIndex | |
InvertedIndex () | |
ArrayList< Score > | search (Set< String > queries, boolean partial) |
Thread-safe version of the InvertedIndex.
edu.usfca.cs272.ThreadSafeInvertedIndex.ThreadSafeInvertedIndex | ( | ) |
Creates a new thread-safe inverted index.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.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 from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.addAll | ( | String | path, |
Collection< String > | stems ) |
Add a collection of stems to Index.
path | Path of file. |
stems | Collection of stems |
Reimplemented from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.addIndex | ( | InvertedIndex | other | ) |
Copies data from another inverted index into this index.
other | a different inverted index |
Reimplemented from edu.usfca.cs272.InvertedIndex.
ArrayList< Score > edu.usfca.cs272.ThreadSafeInvertedIndex.exactSearch | ( | Set< String > | queries | ) |
Performs exact search on a set of queries
queries | set of queries. |
Reimplemented from edu.usfca.cs272.InvertedIndex.
Map< String, Integer > edu.usfca.cs272.ThreadSafeInvertedIndex.getCounts | ( | ) |
Returns unmodifiable map of files and their stem counts.
Reimplemented from edu.usfca.cs272.InvertedIndex.
Set< String > edu.usfca.cs272.ThreadSafeInvertedIndex.getLocations | ( | String | word | ) |
returns the locations in which a word occurs
word | stem to be searched |
Reimplemented from edu.usfca.cs272.InvertedIndex.
Set< Integer > edu.usfca.cs272.ThreadSafeInvertedIndex.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 from edu.usfca.cs272.InvertedIndex.
Set< String > edu.usfca.cs272.ThreadSafeInvertedIndex.getWords | ( | ) |
Returns unmodifiable set of keys in the index.
Reimplemented from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.hasCount | ( | String | location | ) |
checks if stem counts for a location is present.
location | path of file. |
Reimplemented from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.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 from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.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 from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.hasWord | ( | String | word | ) |
checks if word is in the index or not.
word | stem to be looked up |
Reimplemented from edu.usfca.cs272.InvertedIndex.
boolean edu.usfca.cs272.ThreadSafeInvertedIndex.isEmpty | ( | ) |
Returns true if index is empty.
Reimplemented from edu.usfca.cs272.InvertedIndex.
int edu.usfca.cs272.ThreadSafeInvertedIndex.numOfLocations | ( | String | word | ) |
Returns the number of locations where a word occurs.
word | stem to be searched. |
Reimplemented from edu.usfca.cs272.InvertedIndex.
int edu.usfca.cs272.ThreadSafeInvertedIndex.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 from edu.usfca.cs272.InvertedIndex.
ArrayList< Score > edu.usfca.cs272.ThreadSafeInvertedIndex.partialSearch | ( | Set< String > | queries | ) |
Performs partial search on index
queries | set of queries |
Reimplemented from edu.usfca.cs272.InvertedIndex.
int edu.usfca.cs272.ThreadSafeInvertedIndex.size | ( | ) |
Returns the number of stems in the index.
Reimplemented from edu.usfca.cs272.InvertedIndex.
int edu.usfca.cs272.ThreadSafeInvertedIndex.sizeOfCounts | ( | ) |
Returns the number of locations for which there is a stem count.
Reimplemented from edu.usfca.cs272.InvertedIndex.
void edu.usfca.cs272.ThreadSafeInvertedIndex.toJson | ( | Path | output | ) | throws IOException |
writes index in pretty Json to output file.
output | Path of output file. |
IOException | if path is invalid. |
Reimplemented from edu.usfca.cs272.InvertedIndex.
String edu.usfca.cs272.ThreadSafeInvertedIndex.toString | ( | ) |
Returns Inverted Index in pretty Json.
Reimplemented from edu.usfca.cs272.InvertedIndex.