feat(app): add get all addresses feature

This commit is contained in:
2026-01-14 17:50:00 -05:00
parent b2c6898140
commit 12fd2ef45e
2 changed files with 56 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ public interface IQdrantService
Task InitializeCollectionAsync(CancellationToken cancellationToken = default);
Task StoreAddressAsync(Address address, float[] embedding, CancellationToken cancellationToken = default);
Task<List<AddressEmbedding>> SearchSimilarAddressesAsync(float[] queryEmbedding, int limit = 5, float scoreThreshold = 0.0f, CancellationToken cancellationToken = default);
Task<List<AddressEmbedding>> GetAllAddressesAsync(CancellationToken cancellationToken = default);
}
public class QdrantService : IQdrantService
@@ -67,4 +68,22 @@ public class QdrantService : IQdrantService
Score = r.Score
}).ToList();
}
public async Task<List<AddressEmbedding>> GetAllAddressesAsync(CancellationToken cancellationToken = default)
{
var response = await _client.ScrollAsync(_collectionName, limit: 10000, cancellationToken: cancellationToken);
var addresses = new List<AddressEmbedding>();
foreach (var point in response.Result)
{
addresses.Add(new AddressEmbedding
{
Id = Guid.Parse(point.Id.Uuid),
FullAddress = point.Payload["address"].StringValue,
Vector = Array.Empty<float>(),
Score = 0f
});
}
return addresses;
}
}