Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove log
  • Loading branch information
ChunjiangZhu committed Oct 30, 2019
1 parent 7a4b145 commit 2b7cf56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion similarity_search/src/method/hnsw.cc
Expand Up @@ -68,6 +68,8 @@
#define FIELD_MAX_M0 "MAX_M0"
#define CURR_LEVEL "CURR_LEVEL"

#define MAXIMUM_K 1000

namespace similarity {

// This is the counter to keep the size of neighborhood information (for one node)
Expand Down Expand Up @@ -1349,7 +1351,7 @@ namespace similarity {
}
}

SortArrBI<dist_t, HnswNode *> sortedArr(max<size_t>(ef_, 1000)); // max<size_t>(ef_, query->GetK())
SortArrBI<dist_t, HnswNode *> sortedArr(max<size_t>(ef_, MAXIMUM_K)); // max<size_t>(ef_, query->GetK())
sortedArr.push_unsorted_grow(curdist, curNode);

int_fast32_t currElem = 0;
Expand Down
8 changes: 5 additions & 3 deletions similarity_search/src/method/small_world_rand.cc
Expand Up @@ -41,6 +41,8 @@
#define MERGE_BUFFER_ALGO_SWITCH_THRESHOLD 100
#define MAX_ID_TO_SIZE_RATIO 1.5

#define MAXIMUM_K 1000

namespace similarity {

using namespace std;
Expand Down Expand Up @@ -601,8 +603,8 @@ void SmallWorldRand<dist_t>::addCriticalSection(MSWNode *newElement){
template <typename dist_t>
void SmallWorldRand<dist_t>::Search(RangeQuery<dist_t>* query, IdType) const {
// throw runtime_error("Range search is not supported!");
if (searchAlgoType_ == kV1Merge) {std::cerr << "call SearchV1Merge" << endl; SearchV1Merge(query);}
else {std::cerr << "call SearchOld" << endl; SearchOld(query);}
if (searchAlgoType_ == kV1Merge) SearchV1Merge(query);
else SearchOld(query);
}

template <typename dist_t>
Expand Down Expand Up @@ -741,7 +743,7 @@ void SmallWorldRand<dist_t>::SearchV1Merge(RangeQuery<dist_t>* query) const {
MSWNode* currNode = pEntryPoint_;
CHECK_MSG(currNode != nullptr, "Bug: there is not entry point set!")

SortArrBI<dist_t,MSWNode*> sortedArr(efSearch_); // max<size_t>(efSearch_, query->GetK())
SortArrBI<dist_t,MSWNode*> sortedArr(max<size_t>(efSearch_, MAXIMUM_K)); // max<size_t>(efSearch_, query->GetK())

const Object* currObj = currNode->getData();
dist_t d = query->DistanceObjLeft(currObj);
Expand Down

0 comments on commit 2b7cf56

Please sign in to comment.