refactor(8.0): rename HNSWIndex class → JsHnswVectorIndex (scaffold step 3)
Step 3 of the brainy 8.0 rename scaffolding. The class name now matches its role: the JS HNSW implementation of the VectorIndexProvider contract. Per planning § 2.3: this is NOT cosmetic — leaving HNSWIndex when the public contract is VectorIndexProvider creates a confusing read at the implementation layer. CHANGES Repo-wide mechanical rename: HNSWIndex → JsHnswVectorIndex across 52 references in src/ + 5 references in tests/ via sed. Class declaration, imports, JSDoc, comments, and identifiers all updated. src/index.ts - Primary public export: JsHnswVectorIndex (the new name). - Backwards-compat alias: `export const HNSWIndex = JsHnswVectorIndex` with @deprecated note. Removed in the final 8.0 cleanup commit. NO-OP scope No behavioural change. The class is exactly the same; only the name moved. Tests + build green. VERIFICATION - npx tsc --noEmit: clean - npm test: 1468 / 1468 unit
This commit is contained in:
parent
8f87b35614
commit
f39d420cb4
11 changed files with 80 additions and 70 deletions
|
|
@ -21,7 +21,7 @@ import {
|
|||
serializeSQ8,
|
||||
deserializeSQ8
|
||||
} from '../../../src/utils/vectorQuantization.js'
|
||||
import { HNSWIndex } from '../../../src/hnsw/hnswIndex.js'
|
||||
import { JsHnswVectorIndex } from '../../../src/hnsw/hnswIndex.js'
|
||||
import { euclideanDistance } from '../../../src/utils/index.js'
|
||||
import { MemoryStorage } from '../../../src/storage/adapters/memoryStorage.js'
|
||||
|
||||
|
|
@ -286,14 +286,14 @@ describe('SQ8 Quantization', () => {
|
|||
// 4. HNSW SEARCH WITH QUANTIZATION
|
||||
// =================================================================
|
||||
describe('HNSW search with quantization', () => {
|
||||
let index: HNSWIndex
|
||||
let index: JsHnswVectorIndex
|
||||
let storage: MemoryStorage
|
||||
const dim = 32 // Small dimension for fast tests
|
||||
let ids: string[]
|
||||
|
||||
beforeEach(async () => {
|
||||
storage = new MemoryStorage()
|
||||
index = new HNSWIndex(
|
||||
index = new JsHnswVectorIndex(
|
||||
{
|
||||
M: 8,
|
||||
efConstruction: 100,
|
||||
|
|
@ -365,7 +365,7 @@ describe('SQ8 Quantization', () => {
|
|||
describe('two-phase rerank', () => {
|
||||
it('should accept rerank options in search', async () => {
|
||||
const storage = new MemoryStorage()
|
||||
const index = new HNSWIndex(
|
||||
const index = new JsHnswVectorIndex(
|
||||
{
|
||||
M: 8,
|
||||
efConstruction: 100,
|
||||
|
|
@ -399,7 +399,7 @@ describe('SQ8 Quantization', () => {
|
|||
|
||||
it('reranked results should be sorted by exact distance', async () => {
|
||||
const storage = new MemoryStorage()
|
||||
const index = new HNSWIndex(
|
||||
const index = new JsHnswVectorIndex(
|
||||
{
|
||||
M: 8,
|
||||
efConstruction: 100,
|
||||
|
|
@ -432,7 +432,7 @@ describe('SQ8 Quantization', () => {
|
|||
describe('configuration defaults', () => {
|
||||
it('should disable quantization by default', async () => {
|
||||
const storage = new MemoryStorage()
|
||||
const defaultIndex = new HNSWIndex(
|
||||
const defaultIndex = new JsHnswVectorIndex(
|
||||
{ M: 4, efConstruction: 50, efSearch: 20 },
|
||||
euclideanDistance,
|
||||
{ useParallelization: false, storage }
|
||||
|
|
@ -456,7 +456,7 @@ describe('SQ8 Quantization', () => {
|
|||
|
||||
it('should use default rerankMultiplier of 3', async () => {
|
||||
const storage = new MemoryStorage()
|
||||
const index = new HNSWIndex(
|
||||
const index = new JsHnswVectorIndex(
|
||||
{
|
||||
M: 4,
|
||||
efConstruction: 50,
|
||||
|
|
@ -480,7 +480,7 @@ describe('SQ8 Quantization', () => {
|
|||
|
||||
it('should default vectorStorage to memory mode', async () => {
|
||||
const storage = new MemoryStorage()
|
||||
const index = new HNSWIndex(
|
||||
const index = new JsHnswVectorIndex(
|
||||
{ M: 4, efConstruction: 50, efSearch: 20 },
|
||||
euclideanDistance,
|
||||
{ useParallelization: false, storage }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue