Search code examples
vespa

Partial matching with userInput in Vespa


I'm trying to get partial matching with userInput().

With a document title "toucan", I tried:

  • "toucan" (works)
  • "touca" (no results)
  • "touca*" (no results)

The query: ([{"prefix":true}]userInput(@query)))

The schema:

fieldset default {
  fields: title, content
}

field title type string {
  indexing: index | summary
}

field content type string {
  indexing: index | summary
}

Solution

  • Prefix matching requires making the field attribute, not index. See https://docs.vespa.ai/en/text-matching-ranking.html#prefix-match