@@ -2150,96 +2150,69 @@ template <typename DataType, typename DistType>
21502150VecSimIndexInfo HNSWIndex<DataType, DistType>::info() const {
21512151
21522152 VecSimIndexInfo info;
2153+ info.commonInfo = this ->getCommonInfo ();
2154+
21532155 info.algo = VecSimAlgo_HNSWLIB;
2154- info.hnswInfo .dim = this ->dim ;
2155- info.hnswInfo .type = this ->vecType ;
2156- info.hnswInfo .isMulti = this ->isMulti ;
2157- info.hnswInfo .metric = this ->metric ;
2158- info.hnswInfo .blockSize = this ->blockSize ;
21592156 info.hnswInfo .M = this ->getM ();
21602157 info.hnswInfo .efConstruction = this ->getEfConstruction ();
21612158 info.hnswInfo .efRuntime = this ->getEf ();
21622159 info.hnswInfo .epsilon = this ->epsilon_ ;
2163- info.hnswInfo .indexSize = this ->indexSize ();
2164- info.hnswInfo .indexLabelCount = this ->indexLabelCount ();
21652160 info.hnswInfo .max_level = this ->getMaxLevel ();
21662161 info.hnswInfo .entrypoint = this ->getEntryPointLabel ();
2167- info.hnswInfo .memory = this ->getAllocationSize ();
2168- info.hnswInfo .last_mode = this ->last_mode ;
21692162 info.hnswInfo .visitedNodesPoolSize = this ->visited_nodes_handler_pool .getPoolSize ();
2163+ info.hnswInfo .numberOfMarkedDeletedNodes = this ->getNumMarkedDeleted ();
21702164 return info;
21712165}
21722166
21732167template <typename DataType, typename DistType>
21742168VecSimInfoIterator *HNSWIndex<DataType, DistType>::infoIterator() const {
21752169 VecSimIndexInfo info = this ->info ();
21762170 // For readability. Update this number when needed.
2177- size_t numberOfInfoFields = 12 ;
2171+ size_t numberOfInfoFields = 13 ;
21782172 VecSimInfoIterator *infoIterator = new VecSimInfoIterator (numberOfInfoFields);
21792173
21802174 infoIterator->addInfoField (VecSim_InfoField{
21812175 .fieldName = VecSimCommonStrings::ALGORITHM_STRING,
21822176 .fieldType = INFOFIELD_STRING,
21832177 .fieldValue = {FieldValue{.stringValue = VecSimAlgo_ToString (info.algo )}}});
2184- infoIterator->addInfoField (VecSim_InfoField{
2185- .fieldName = VecSimCommonStrings::TYPE_STRING,
2186- .fieldType = INFOFIELD_STRING,
2187- .fieldValue = {FieldValue{.stringValue = VecSimType_ToString (info.hnswInfo .type )}}});
2188- infoIterator->addInfoField (
2189- VecSim_InfoField{.fieldName = VecSimCommonStrings::DIMENSION_STRING,
2190- .fieldType = INFOFIELD_UINT64,
2191- .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .dim }}});
2192- infoIterator->addInfoField (VecSim_InfoField{
2193- .fieldName = VecSimCommonStrings::METRIC_STRING,
2194- .fieldType = INFOFIELD_STRING,
2195- .fieldValue = {FieldValue{.stringValue = VecSimMetric_ToString (info.hnswInfo .metric )}}});
21962178
2197- infoIterator->addInfoField (
2198- VecSim_InfoField{.fieldName = VecSimCommonStrings::IS_MULTI_STRING,
2199- .fieldType = INFOFIELD_UINT64,
2200- .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .isMulti }}});
2201- infoIterator->addInfoField (
2202- VecSim_InfoField{.fieldName = VecSimCommonStrings::INDEX_SIZE_STRING,
2203- .fieldType = INFOFIELD_UINT64,
2204- .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .indexSize }}});
2205- infoIterator->addInfoField (VecSim_InfoField{
2206- .fieldName = VecSimCommonStrings::INDEX_LABEL_COUNT_STRING,
2207- .fieldType = INFOFIELD_UINT64,
2208- .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .indexLabelCount }}});
2179+ this ->addCommonInfoToIterator (infoIterator, info.commonInfo );
2180+
22092181 infoIterator->addInfoField (
22102182 VecSim_InfoField{.fieldName = VecSimCommonStrings::HNSW_M_STRING,
22112183 .fieldType = INFOFIELD_UINT64,
22122184 .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .M }}});
2185+
22132186 infoIterator->addInfoField (VecSim_InfoField{
22142187 .fieldName = VecSimCommonStrings::HNSW_EF_CONSTRUCTION_STRING,
22152188 .fieldType = INFOFIELD_UINT64,
22162189 .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .efConstruction }}});
2190+
22172191 infoIterator->addInfoField (
22182192 VecSim_InfoField{.fieldName = VecSimCommonStrings::HNSW_EF_RUNTIME_STRING,
22192193 .fieldType = INFOFIELD_UINT64,
22202194 .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .efRuntime }}});
2195+
22212196 infoIterator->addInfoField (
22222197 VecSim_InfoField{.fieldName = VecSimCommonStrings::HNSW_MAX_LEVEL,
22232198 .fieldType = INFOFIELD_UINT64,
22242199 .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .max_level }}});
2200+
22252201 infoIterator->addInfoField (
22262202 VecSim_InfoField{.fieldName = VecSimCommonStrings::HNSW_ENTRYPOINT,
22272203 .fieldType = INFOFIELD_UINT64,
22282204 .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .entrypoint }}});
2229- infoIterator->addInfoField (
2230- VecSim_InfoField{.fieldName = VecSimCommonStrings::MEMORY_STRING,
2231- .fieldType = INFOFIELD_UINT64,
2232- .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .memory }}});
2233- infoIterator->addInfoField (
2234- VecSim_InfoField{.fieldName = VecSimCommonStrings::SEARCH_MODE_STRING,
2235- .fieldType = INFOFIELD_STRING,
2236- .fieldValue = {FieldValue{
2237- .stringValue = VecSimSearchMode_ToString (info.hnswInfo .last_mode )}}});
2205+
22382206 infoIterator->addInfoField (
22392207 VecSim_InfoField{.fieldName = VecSimCommonStrings::HNSW_EPSILON_STRING,
22402208 .fieldType = INFOFIELD_FLOAT64,
22412209 .fieldValue = {FieldValue{.floatingPointValue = info.hnswInfo .epsilon }}});
22422210
2211+ infoIterator->addInfoField (VecSim_InfoField{
2212+ .fieldName = VecSimCommonStrings::HNSW_NUM_MARKED_DELETED,
2213+ .fieldType = INFOFIELD_UINT64,
2214+ .fieldValue = {FieldValue{.uintegerValue = info.hnswInfo .numberOfMarkedDeletedNodes }}});
2215+
22432216 return infoIterator;
22442217}
22452218
0 commit comments