|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * @since Oct 2023 |
| 4 | + * @author Haydar KULEKCI <haydarkulekci@gmail.com> |
| 5 | + */ |
| 6 | + |
| 7 | +namespace Qdrant\Tests\Unit\Models\Request\CollectionConfig; |
| 8 | + |
| 9 | +use PHPUnit\Framework\TestCase; |
| 10 | +use Qdrant\Models\Request\CollectionConfig\BinaryQuantization; |
| 11 | +use Qdrant\Models\Request\CollectionConfig\OptimizersConfigDiff; |
| 12 | + |
| 13 | +class OptimizerConfigDiffTest extends TestCase |
| 14 | +{ |
| 15 | + public function testBasic(): void |
| 16 | + { |
| 17 | + $config = new OptimizersConfigDiff(); |
| 18 | + |
| 19 | + $this->assertEquals([], $config->toArray()); |
| 20 | + } |
| 21 | + |
| 22 | + public function testWithIndexingThreshold(): void |
| 23 | + { |
| 24 | + $config = (new OptimizersConfigDiff())->setIndexingThreshold(10); |
| 25 | + |
| 26 | + $this->assertEquals([ |
| 27 | + 'indexing_threshold' => 10 |
| 28 | + ], $config->toArray()); |
| 29 | + } |
| 30 | + |
| 31 | + public function testWithMaxOptimizationThreads(): void |
| 32 | + { |
| 33 | + $config = (new OptimizersConfigDiff())->setMaxOptimizationThreads(10); |
| 34 | + |
| 35 | + $this->assertEquals([ |
| 36 | + 'max_optimization_threads' => 10 |
| 37 | + ], $config->toArray()); |
| 38 | + } |
| 39 | + |
| 40 | + public function testWithMaxSegmentSize(): void |
| 41 | + { |
| 42 | + $config = (new OptimizersConfigDiff())->setMaxSegmentSize(10); |
| 43 | + |
| 44 | + $this->assertEquals([ |
| 45 | + 'max_segment_size' => 10 |
| 46 | + ], $config->toArray()); |
| 47 | + } |
| 48 | + |
| 49 | + public function testWithDeletedThreshold(): void |
| 50 | + { |
| 51 | + $config = (new OptimizersConfigDiff())->setDeletedThreshold(9.8); |
| 52 | + |
| 53 | + $this->assertEquals([ |
| 54 | + 'deleted_threshold' => 9.8 |
| 55 | + ], $config->toArray()); |
| 56 | + } |
| 57 | + |
| 58 | + public function testWithMemmapThreshold(): void |
| 59 | + { |
| 60 | + $config = (new OptimizersConfigDiff())->setMemmapThreshold(10); |
| 61 | + |
| 62 | + $this->assertEquals([ |
| 63 | + 'memmap_threshold' => 10 |
| 64 | + ], $config->toArray()); |
| 65 | + } |
| 66 | + |
| 67 | + public function testWithDefaultSegmentNumber(): void |
| 68 | + { |
| 69 | + $config = (new OptimizersConfigDiff())->setDefaultSegmentNumber(10); |
| 70 | + |
| 71 | + $this->assertEquals([ |
| 72 | + 'default_segment_number' => 10 |
| 73 | + ], $config->toArray()); |
| 74 | + } |
| 75 | + |
| 76 | + public function testWithFlushIntervalSec(): void |
| 77 | + { |
| 78 | + $config = (new OptimizersConfigDiff())->setFlushIntervalSec(10); |
| 79 | + |
| 80 | + $this->assertEquals([ |
| 81 | + 'flush_interval_sec' => 10 |
| 82 | + ], $config->toArray()); |
| 83 | + } |
| 84 | + |
| 85 | + public function testWithVacuumMinVectorNumber(): void |
| 86 | + { |
| 87 | + $config = (new OptimizersConfigDiff())->setVacuumMinVectorNumber(10); |
| 88 | + |
| 89 | + $this->assertEquals([ |
| 90 | + 'vacuum_min_vector_number' => 10 |
| 91 | + ], $config->toArray()); |
| 92 | + } |
| 93 | +} |
0 commit comments