-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the image examples for avs-client-java 0.3.0. Updated the run…
… instructions.
- Loading branch information
1 parent
0e44169
commit 72e9cc2
Showing
9 changed files
with
515 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/dependency-reduced-pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Proximus Java Client | ||
|
||
This project demonstrates the use of Aerospike's vector database capabilities with `AdminClient` and `Client` classes. The project is configured with Maven and includes sample data for testing vector search functionalities. | ||
|
||
## Overview | ||
- This is a demo project to illustrate how can a simple image search application can be built with Aerospike Vector database using vector database java client. | ||
|
||
## Prerequisites | ||
|
||
- Java 21 | ||
- An AVS **0.9.0** running locally and accessible from the application. If the AVS is not available locally then update `HOSTNAME` and `PORT` In `SetupUtils.java`, other connection related information can be also updated in this file. | ||
|
||
## Build and run | ||
- run `mvn package` command from `avs-client-java` directory. | ||
- run `java -jar target/avs-client-java-demo-0.3.0.jar` | ||
|
||
## Project Structure | ||
|
||
``` | ||
client-test/ | ||
├── src/ | ||
│ ├── main/ | ||
│ │ ├── java/ | ||
│ │ │ └── com/ | ||
│ │ │ └── aerospike/ | ||
│ │ │ ├── App.java | ||
│ │ │ └── SetupUtils.java | ||
│ └── resources/ | ||
│ └── sift/ | ||
│ ├── siftsmall_base.fvecs | ||
│ ├── siftsmall_groundtruth.ivecs | ||
│ └── siftsmall_query.fvecs | ||
└── pom.xml | ||
``` | ||
|
||
## Maven Configuration | ||
|
||
Necessary `pom.xml` configuration for the project: | ||
|
||
```xml | ||
<dependencies> | ||
<!-- avs java client dependency --> | ||
<dependency> | ||
<groupId>com.aerospike</groupId> | ||
<artifactId>avs-client-java</artifactId> | ||
<version>0.3.0</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
|
||
## Application Code | ||
`App.java` This class initializes the setup and test methods for the vector database. | ||
|
||
### SetupUtils.java | ||
- This class handles the setup of the vector database and the asynchronous vector search tests. | ||
- What it does: Load Data: | ||
- Loads base vectors, query vectors, and ground truth vectors from files. | ||
- Initialize Clients: | ||
- Sets up `Client` and `AdminClient` using the provided Aerospike host(`localhost`) and port (`10000`). | ||
- Create Index: Creates an index in the Aerospike database for storing vector data. | ||
- Insert Vectors: Inserts the base vectors into the Aerospike database. | ||
- Wait for Merge: Waits until all records are merged in the index. | ||
- Perform Vector Search: Executes asynchronous vector searches using the query vectors. | ||
- Computes recall metrics to evaluate the search results. | ||
|
||
- Key Methods: | ||
- `setup(String host, int port)`: Handles data loading, client initialization, index creation, vector insertion, and waiting for records to merge. | ||
- `testVectorSearchAsync()`: Executes the vector search tests and computes recall metrics. | ||
|
||
|
||
### Javadocs | ||
Please refer to the [javadocs](https://javadoc.io/doc/com.aerospike/avs-client-java/latest/index.html) for more details. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.aerospike</groupId> | ||
<artifactId>avs-client-java-demo</artifactId> | ||
<packaging>jar</packaging> | ||
<version>0.3.0</version> | ||
<name>avs-client-java-demo</name> | ||
<description>Aerospike Vector Database Java Client Demo Project</description> | ||
<url>https://aerospike.com/docs/vector </url> | ||
|
||
<licenses> | ||
<license> | ||
<name>The Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<organization> | ||
<name>Aerospike Inc.</name> | ||
<url>https://www.aerospike.com</url> | ||
</organization> | ||
|
||
<developers> | ||
<developer> | ||
<id>rkumar-aerospike</id> | ||
<name>Rahul Kumar</name> | ||
<email>[email protected]</email> | ||
<url>https://aerospike.com/docs/vector/develop/java</url> | ||
<organization>Aerospike Inc.</organization> | ||
<organizationUrl>https://www.aerospike.com</organizationUrl> | ||
<roles> | ||
<role>developer</role> | ||
</roles> | ||
<timezone>America/Los_Angeles</timezone> | ||
</developer> | ||
</developers> | ||
|
||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>21</maven.compiler.source> | ||
<maven.compiler.target>21</maven.compiler.target> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.13.0</version> | ||
<configuration> | ||
<source>${maven.compiler.source}</source> | ||
<target>${maven.compiler.target}</target> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>com.aerospike.App</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
|
||
<!-- Logback dependencies --> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.2.3</version> | ||
</dependency> | ||
|
||
<!-- Aerospike client dependencies --> | ||
<dependency> | ||
<groupId>com.aerospike</groupId> | ||
<artifactId>avs-client-java</artifactId> | ||
<version>0.3.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.aerospike; | ||
|
||
public class App { | ||
|
||
public static void main(String[] args) { | ||
|
||
SetupUtils su = new SetupUtils(); | ||
try { | ||
su.setup(); | ||
su.testVectorSearchAsync(); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
}finally { | ||
su.close(); | ||
} | ||
} | ||
} |
Oops, something went wrong.