Commit Graph

3 Commits (135d3fdf43973781bb64c0a3821aca6503459d58)

Author SHA1 Message Date
Matthijs Douze af25054e2d support IDSelector in more classes (#2509)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2509

Adds support for:
- IDSelector for Flat and SQ
- search_type in SearchParametersPQ
- IDSelectors implemented in Python (slow but good for testing)

Start optimization of IDSelectorRange and IDSelectorArray for IndexFlat and IDSelectorRange for IndexIVF

Reviewed By: alexanderguzhva

Differential Revision: D40037795

fbshipit-source-id: 61e01acb43c6aa39fea2c3b67a8bba9072383b74
2022-10-06 23:03:23 -07:00
Matthijs Douze df9c49c335 fix windows compilation and test (#2505)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2505

the SearchParameters made the swig wrapper too long. This diff attempts to work around.

Reviewed By: alexanderguzhva

Differential Revision: D39998713

fbshipit-source-id: 6938b5ca1c64bdc748899407909f7e59f62c0de3
2022-10-03 01:42:16 -07:00
Matthijs Douze dd814b5f14 IVF filtering based on IDSelector (no init split) (#2483)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2483

This diff changes the following:
1. all search functions now take a `SearchParameters` argument that overrides the internal search parameters
2. the default implementation for most classes throws when the params argument is non-nullptr / non-None
3. the IndexIVF and IndexHNSW classes have functioning SearchPArameters
4. the SearchParameters includes an IDSelector that can search only in a subset of the index based on a defined subset of ids

There is also some refactoring: the IDSelector was moved to its own .h/.cpp and python/__init__.py is spit in parts.

The diff is quite bulky because the search function prototypes need to be changed in all index classes.

Things to fix in subsequent diffs:

- support SearchParameters for more index types (Flat variants)

- better sub-object ownership for SearchParams (with std::unique_ptr?)

- special handling of IDSelectorRange to make it faster

Reviewed By: alexanderguzhva

Differential Revision: D39852589

fbshipit-source-id: 4988bdb5b9bee1207cd327d3f80bf5e0e2467fe1
2022-09-30 06:40:03 -07:00