-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test cases for gosdk v2 index (#34431)
issue: #33419 - Add test cases for gosdk v2 index - Add sparse index for go client Signed-off-by: ThreadDao <yufen.zong@zilliz.com>
- Loading branch information
Showing
16 changed files
with
1,375 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package index | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
const ( | ||
dropRatio = `drop_ratio_build` | ||
) | ||
|
||
var _ Index = sparseInvertedIndex{} | ||
|
||
// IndexSparseInverted index type for SPARSE_INVERTED_INDEX | ||
type sparseInvertedIndex struct { | ||
baseIndex | ||
dropRatio float64 | ||
} | ||
|
||
func (idx sparseInvertedIndex) Params() map[string]string { | ||
return map[string]string{ | ||
MetricTypeKey: string(idx.metricType), | ||
IndexTypeKey: string(SparseInverted), | ||
dropRatio: fmt.Sprintf("%v", idx.dropRatio), | ||
} | ||
} | ||
|
||
func NewSparseInvertedIndex(metricType MetricType, dropRatio float64) Index { | ||
return sparseInvertedIndex { | ||
baseIndex: baseIndex{ | ||
metricType: metricType, | ||
indexType: SparseInverted, | ||
}, | ||
|
||
dropRatio: dropRatio, | ||
} | ||
} | ||
|
||
var _ Index = sparseWANDIndex{} | ||
type sparseWANDIndex struct { | ||
baseIndex | ||
dropRatio float64 | ||
} | ||
|
||
func (idx sparseWANDIndex) Params() map[string]string { | ||
return map[string]string{ | ||
MetricTypeKey: string(idx.metricType), | ||
IndexTypeKey: string(SparseWAND), | ||
dropRatio: fmt.Sprintf("%v", idx.dropRatio), | ||
} | ||
} | ||
|
||
// IndexSparseWAND index type for SPARSE_WAND, weak-and | ||
func NewSparseWANDIndex(metricType MetricType, dropRatio float64) Index { | ||
return sparseWANDIndex { | ||
baseIndex: baseIndex{ | ||
metricType: metricType, | ||
indexType: SparseWAND, | ||
}, | ||
|
||
dropRatio: dropRatio, | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.