@@ -843,6 +843,23 @@ void PQFlashIndex<T, LabelT>::load_dummy_map(const std::string &dummy_map_filepa
843843 throw FileException (dummy_map_filepath, e, __FUNCSIG__, __FILE__, __LINE__);
844844 }
845845}
846+
847+
848+ template <typename T, typename LabelT>
849+ #ifdef EXEC_ENV_OLS
850+ bool PQFlashIndex<T, LabelT>::use_filter_support (MemoryMappedFiles &files)
851+ #else
852+ bool PQFlashIndex<T, LabelT>::use_filter_support ()
853+ #endif
854+ {
855+ std::string labels_file = _disk_index_file + " _labels.txt" ;
856+ #ifdef EXEC_ENV_OLS
857+ return files.fileExists (labels_file);
858+ #else
859+ return file_exists (labels_file);
860+ #endif
861+ }
862+
846863#ifdef EXEC_ENV_OLS
847864template <typename T, typename LabelT>
848865void PQFlashIndex<T, LabelT>::load_labels (MemoryMappedFiles &files, const std::string &disk_index_file)
@@ -1090,7 +1107,11 @@ int PQFlashIndex<T, LabelT>::load_from_separate_paths(uint32_t num_threads, cons
10901107 // bytes are needed to store the header and read in that many using our
10911108 // 'standard' aligned file reader approach.
10921109 reader->open (_disk_index_file);
1093- this ->setup_thread_data (num_threads);
1110+ this ->setup_thread_data (
1111+ num_threads,
1112+ defaults::VISITED_RESERVE,
1113+ defaults::MAX_GRAPH_DEGREE,
1114+ (use_filter_support (files)? defaults::MAX_FILTERS_PER_QUERY, 0 ));
10941115 this ->_max_nthreads = num_threads;
10951116
10961117 char *bytes = getHeaderBytes ();
@@ -1180,7 +1201,11 @@ int PQFlashIndex<T, LabelT>::load_from_separate_paths(uint32_t num_threads, cons
11801201 // open AlignedFileReader handle to index_file
11811202 std::string index_fname (_disk_index_file);
11821203 reader->open (index_fname);
1183- this ->setup_thread_data (num_threads);
1204+ this ->setup_thread_data (
1205+ num_threads,
1206+ defaults::VISITED_RESERVE,
1207+ defaults::MAX_GRAPH_DEGREE,
1208+ (use_filter_support ()? defaults::MAX_FILTERS_PER_QUERY, 0 ));
11841209 this ->_max_nthreads = num_threads;
11851210
11861211#endif
0 commit comments