Skip to content

Commit

Permalink
Added java comments, java docs.
Browse files Browse the repository at this point in the history
Signed-off-by: Dooyong Kim <[email protected]>
  • Loading branch information
Dooyong Kim committed Oct 17, 2024
1 parent da59f34 commit c380d84
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ public static List<String> getEngineFiles(String extension, String fieldName, Se
return engineFiles;
}

/**
* Get engine file name from given field and segment info.
* Ex: _0_165_my_field.faiss
*
* @param field : Field info that might have a vector index file. Not always it has it.
* @param segmentInfo : Segment where we are collecting an engine file list.
* @return : Found vector engine names, if not found, returns null.
*/
public static String getEngineFileFromFieldInfo(FieldInfo field, SegmentInfo segmentInfo) {
if (!field.attributes().containsKey(KNN_FIELD)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public static String constructCacheKey(final String vectorIndexFileName, final S
return cacheKey;
}

/**
* From cacheKey, we extract a vector file name.
* Note that expected format of cacheKey consists of two part with '@' as a delimiter.
* First part would be the vector file name, the second one is the segment id.
*
* @param cacheKey : Cache key for {@link org.opensearch.knn.index.memory.NativeMemoryCacheManager}
* @return : Vector file name, if the given cacheKey was invalid format, returns null.
*/
public static String extractVectorIndexFileName(final String cacheKey) {
final int indexOfDelimiter = cacheKey.indexOf('@');
if (indexOfDelimiter != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class IndexAllocation implements NativeMemoryAllocation {
* @param memoryAddress Pointer in memory to the index
* @param sizeKb Size this index consumes in kilobytes
* @param knnEngine KNNEngine associated with the index allocation
* @param vectorFileName File path to index
* @param vectorFileName Vector file name. Ex: _0_165_my_field.faiss
* @param openSearchIndexName Name of OpenSearch index this index is associated with
*/
IndexAllocation(
Expand All @@ -150,7 +150,7 @@ class IndexAllocation implements NativeMemoryAllocation {
* @param memoryAddress Pointer in memory to the index
* @param sizeKb Size this index consumes in kilobytes
* @param knnEngine KNNEngine associated with the index allocation
* @param vectorFileName Vector file name
* @param vectorFileName Vector file name. Ex: _0_165_my_field.faiss
* @param openSearchIndexName Name of OpenSearch index this index is associated with
* @param sharedIndexState Shared index state. If not shared state present, pass null.
*/
Expand Down

0 comments on commit c380d84

Please sign in to comment.