Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Vespa sample applications - Basic search with tensors

A basic Vespa application, which supports feeding and running simple queries using tensors.

Also includes the rank expression playground used to visualize rank operations. This sample application is based on basic-search-java which requires building the application using maven before deploying. See Developing application. Once deployed you can view the tensor playground:

http://<host>:8080/playground/index.html

Please refer to the tensor intro and tensor user guide for more information.

Executable example

Check-out, compile and run:

$ git clone https://github.com/vespa-engine/sample-apps.git
$ export VESPA_SAMPLE_APPS=`pwd`/sample-apps
$ cd $VESPA_SAMPLE_APPS/basic-search-tensor && mvn clean package
$ docker run --detach --name vespa --hostname vespa-container --privileged \
  --volume $VESPA_SAMPLE_APPS:/vespa-sample-apps --publish 8080:8080 vespaengine/vespa

Wait for the configserver to start:

$ docker exec vespa bash -c 'curl -s --head http://localhost:19071/ApplicationStatus'

Deploy the application:

$ docker exec vespa bash -c '/opt/vespa/bin/vespa-deploy prepare /vespa-sample-apps/basic-search-tensor/target/application.zip && \
  /opt/vespa/bin/vespa-deploy activate'

Wait for the application to start:

$ curl -s --head http://localhost:8080/ApplicationStatus

Feed data into application:

$ curl -s -X POST --data-binary @${VESPA_SAMPLE_APPS}/basic-search-tensor/music-data-1.json \
    http://localhost:8080/document/v1/music/music/docid/1 | python -m json.tool
$ curl -s -X POST --data-binary @${VESPA_SAMPLE_APPS}/basic-search-tensor/music-data-2.json \
    http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool

Test the application:

$ curl -s 'http://localhost:8080/search/?query=sddocname:music&tensor=%7B%7Bx%3A0%7D%3A1.0%2C%7Bx%3A1%7D%3A2.0%2C%7Bx%3A2%7D%3A3.0%2C%7Bx%3A3%7D%3A5.0%7D' | python -m json.tool

Shutdown and remove the container:

$  docker rm -f vespa