The Vespa app that powers CORD-19 Search is deployed on Vespa Cloud.
To run the same application on your own laptop, you can use the free and open source Vespa container image.
Running the application locally is easy and enables you to play with ranking features, see also the trec-covid relevance reproducing steps for how to evaluate ranking methods using the trec-covid dataset relevance dataset.
All Vespa Cloud applications can be run locally.
Prerequisites:
- Docker installed
- Git installed
- Operating system: macOS or Linux
- Architecture: x86_64 or arm64
- Minimum 4 GB memory dedicated to Docker (the default is 2 GB on Macs). Refer to Docker memory for details and troubleshooting.
- Java 17 installed.
- Apache Maven. This sample app uses custom Java components and Maven is used to build the application.
- zstd:
brew install zstd
Validate Docker resource settings, should be minimum 4 GB:
$ docker info | grep "Total Memory"
Install Vespa CLI.
$ brew install vespa-cli
Set target env, it's also possible to deploy to Vespa Cloud using target cloud.
For local deployment using docker image use
$ vespa config set target local
For cloud deployment using Vespa Cloud use
$ vespa config set target cloud $ vespa config set application tenant-name.myapp.default $ vespa auth login $ vespa auth cert
See also Cloud Vespa getting started guide. It's possible
to switch between local deployment and cloud deployment by changing the config target
.
Clone this repo:
$ git clone https://github.com/vespa-cloud/cord-19-search.git && cd cord-19-search
Generate a feed-file.jsonl
in current directory by following the procedure
in feeding.md, or skip this step and use a small sample feed.
Build the application using Maven:
$ mvn -U clean install
Start the vespa container
$ docker run --detach --name cord19 --hostname vespa-container \ --publish 8080:8080 --publish 19071:19071 \ vespaengine/vespa
Deploy the application. This step deploys the application package built in the previous step:
$ vespa deploy --wait 300
Wait for the application endpoint to become available:
$ vespa status --wait 300
Feed sample data using the Vespa CLI:
$ zstdcat sample-feed/sample-feed.jsonl.zst | vespa feed -t http://localhost:8080 -
Alternatively, feed the generated feed file feed-file.jsonl
:
$ vespa feed -t http://localhost:8080 feed-file.jsonl
Run a query:
$ vespa query 'yql=select title,abstract from doc where userQuery()' 'query=covid-19 prevention strategies' 'ranking=bm25'
To print the curl
equivelent use vespa query -v
:
$ vespa query -v 'yql=select title,abstract from doc where userQuery()' 'query=covid-19 prevention strategies' 'ranking=bm25'
ColBERT re-ranking only:
$ vespa query 'yql=select title,abstract from doc where userQuery()' 'query=covid-19 prevention strategies' 'ranking=colbert'
Hybrid re-ranking:
$ vespa query 'yql=select title,abstract from doc where userQuery()' 'query=covid-19 prevention strategies' 'ranking=hybrid-colbert'
Hybrid re-ranking and cross-encoder re-ranking:
$ vespa query 'yql=select title,abstract from doc where userQuery()' 'query=covid-19 prevention strategies' 'ranking=hybrid-colbert' 'cross-rerank=true'
Clean up and remove the container
$ docker rm -f cord19