Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/clients/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Client sample

The directory `app/` contains a minimal Vespa application which can be used to test the client implementation.

`dataset/` contains some sample data for feeding.

Before testing any clients, deploy the Vespa application:

```bash
vespa deploy --wait 300 app
```
22 changes: 22 additions & 0 deletions examples/clients/app/schemas/passage.sd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
schema passage {
document passage {
Comment on lines +1 to +2
field id type string {
indexing: summary | attribute
}

field text type string {
indexing: summary | index
index: enable-bm25
}
}

fieldset default {
fields: text
}

rank-profile default {
first-phase {
expression: bm25(text)
}
}
}
20 changes: 20 additions & 0 deletions examples/clients/app/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the
project root. -->
<services version="1.0" xmlns:deploy="vespa" xmlns:preprocess="properties">
<container id="default" version="1.0">
<search />
<document-api />
<nodes count="2">
</nodes>
</container>
<content version="1.0" id="content">
<min-redundancy>2</min-redundancy>
<documents>
<document type="passage" mode="index"/>
</documents>
<nodes count="2">
</nodes>
</content>

</services>
12 changes: 12 additions & 0 deletions examples/clients/client-java/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

10 changes: 10 additions & 0 deletions examples/clients/client-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Ignore Kotlin plugin data
.kotlin

app/bin
23 changes: 23 additions & 0 deletions examples/clients/client-java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Usage

Make sure the top-level Vespa application is deployed.

Configure endpoint and identity files in `VespaClient.java`.

## Feed

```bash
gradle run --args="--feed ../dataset/docs.jsonl"
```

## Perform a simple query

```bash
gradle run --args="--query \"longest word in spanish\""
```

## Perform a query load test

```bash
gradle run --args="--load-test"
```
34 changes: 34 additions & 0 deletions examples/clients/client-java/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
application
}

repositories {
mavenCentral()
}

dependencies {
testImplementation(libs.junit)

implementation(libs.guava)

implementation("io.github.hakky54:ayza-for-pem:10.0.3")
implementation("org.eclipse.jetty:jetty-client:12.1.7")
implementation("org.eclipse.jetty.http2:jetty-http2-client-transport:12.1.7")
implementation("org.slf4j:slf4j-simple:2.0.17")
implementation("commons-cli:commons-cli:1.11.0")
implementation("com.yahoo.vespa:vespa-feed-client:8.643.19");
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

application {
mainClass = "com.example.VespaClient"
}

tasks.named<JavaExec>("run") {
workingDir = file(System.getProperty("user.dir"))
}
Loading
Loading