Skip to content

Commit

Permalink
Fixing compile errors and some formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gopal-msr committed Nov 4, 2024
1 parent 907af17 commit d9eaf13
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 298 deletions.
38 changes: 14 additions & 24 deletions include/abstract_filter_store.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
#pragma once
#include "multi_filter/abstract_predicate.h"
#include "types.h"
#include "windows_customizations.h"
#include <vector>

namespace diskann {
template <typename LabelT> class AbstractFilterStore {
public:
/// <summary>
/// Returns the filters for a data point. Only valid for base points
/// </summary>
/// <param name="point">base point id</param>
/// <returns>list of filters of the base point</returns>
virtual const std::vector<LabelT> &
get_filters_for_point(location_t point) const = 0;
DISKANN_DLLEXPORT virtual bool has_filter_support() const = 0;

DISKANN_DLLEXPORT virtual bool
point_has_label(location_t point_id, const LabelT label_id) const = 0;

/// <summary>
/// Adds filters for a point.
/// </summary>
/// <param name="point"></param>
/// <param name="filters"></param>
virtual void add_filters_for_point(location_t point,
const std::vector<LabelT> &filters) = 0;
// Returns true if the index is filter-enabled and all files were loaded
// correctly. false otherwise. Note that "false" can mean that the index
// does not have filter support, or that some index files do not exist, or
// that they exist and could not be opened.
DISKANN_DLLEXPORT virtual bool load(const std::string &disk_index_file) = 0;

/// <summary>
/// Returns a score between [0,1] indicating how many points in the dataset
/// matched the predicate
/// </summary>
/// <param name="pred">Predicate to match</param>
/// <returns>Score between [0,1] indicate %age of points matching
/// pred</returns>
virtual float
get_predicate_selectivity(const AbstractPredicate &pred) const = 0;
DISKANN_DLLEXPORT virtual void
generate_random_labels(std::vector<LabelT> &labels, const uint32_t num_labels,
const uint32_t nthreads) = 0;
};

} // namespace diskann
1 change: 1 addition & 0 deletions include/distance.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "windows_customizations.h"
#include <cstdint>
#include <cstring>

namespace diskann {
Expand Down
27 changes: 0 additions & 27 deletions include/in_mem_filter_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@ class InMemFilterStore : public AbstractFilterStore<LabelT> {

DISKANN_DLLEXPORT virtual bool has_filter_support() const;

/// <summary>
/// Returns the filters for a data point. Only valid for base points
/// </summary>
/// <param name="point">base point id</param>
/// <returns>list of filters of the base point</returns>
DISKANN_DLLEXPORT virtual const std::vector<LabelT> &
get_filters_for_point(location_t point) const override;

/// <summary>
/// Adds filters for a point.
/// </summary>
/// <param name="point"></param>
/// <param name="filters"></param>
DISKANN_DLLEXPORT virtual void
add_filters_for_point(location_t point,
const std::vector<LabelT> &filters) override;

/// <summary>
/// Returns a score between [0,1] indicating how many points in the dataset
/// matched the predicate
/// </summary>
/// <param name="pred">Predicate to match</param>
/// <returns>Score between [0,1] indicate %age of points matching
/// pred</returns>
DISKANN_DLLEXPORT virtual float
get_predicate_selectivity(const AbstractPredicate &pred) const override;

DISKANN_DLLEXPORT virtual const std::unordered_map<LabelT,
std::vector<location_t>> &
get_label_to_medoids() const;
Expand Down
3 changes: 2 additions & 1 deletion include/index_build_params.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "ann_exception.h"
#include "common_includes.h"
#include "parameters.h"

Expand Down Expand Up @@ -29,7 +30,7 @@ class IndexFilterParamsBuilder {
IndexFilterParamsBuilder &
with_save_path_prefix(const std::string &save_path_prefix) {
if (save_path_prefix.empty() || save_path_prefix == "")
throw ANNException("Error: save_path_prefix can't be empty", -1);
throw diskann::ANNException("Error: save_path_prefix can't be empty", -1);
this->_save_path_prefix = save_path_prefix;
return *this;
}
Expand Down
2 changes: 2 additions & 0 deletions include/index_config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include "ann_exception.h"
#include "common_includes.h"
#include "logger.h"
#include "parameters.h"

namespace diskann {
Expand Down
14 changes: 0 additions & 14 deletions include/multi_filter/abstract_predicate.h

This file was deleted.

9 changes: 0 additions & 9 deletions include/multi_filter/filter_matcher.h

This file was deleted.

44 changes: 0 additions & 44 deletions include/multi_filter/simple_boolean_predicate.h

This file was deleted.

12 changes: 7 additions & 5 deletions include/restapi/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
#include <cpprest/base_uri.h>
#include <restapi/search_wrapper.h>

namespace diskann
{
namespace diskann {
// Constants
static const std::string VECTOR_KEY = "query", K_KEY = "k", INDICES_KEY = "indices", DISTANCES_KEY = "distances",
TAGS_KEY = "tags", QUERY_ID_KEY = "query_id", ERROR_MESSAGE_KEY = "error", L_KEY = "Ls",
TIME_TAKEN_KEY = "time_taken_in_us", PARTITION_KEY = "partition",
static const std::string VECTOR_KEY = "query", K_KEY = "k",
INDICES_KEY = "indices", DISTANCES_KEY = "distances",
TAGS_KEY = "tags", QUERY_ID_KEY = "query_id",
ERROR_MESSAGE_KEY = "error", L_KEY = "Ls",
TIME_TAKEN_KEY = "time_taken_in_us",
PARTITION_KEY = "partition",
UNKNOWN_ERROR = "unknown_error";
const unsigned int DEFAULT_L = 100;

Expand Down
Loading

0 comments on commit d9eaf13

Please sign in to comment.