WPSOLR
WPSOLR

Reputation: 50

Cannot get dynamic highlightings with Vespa

I'm looking for a small example to produce a dynamic summary from a string field.

The content:

{"wpsolr_title": "Hamster one"}

The schema:

field wpsolr_title type string {
  indexing: index | summary
  summary: dynamic
}

fieldset default {
  fields: wpsolr_title
}

The query:

{"query":"hamster","yql":"select wpsolr_title from wpsolr30 where (userInput(@query))"}

The results:

{ "fields": { "wpsolr_title": "Hamster one"} }

Upvotes: 0

Views: 108

Answers (2)

WPSOLR
WPSOLR

Reputation: 50

It appears that adding a where condition to the userInput prevents the summary in results.

userInput() alone:

vespa query \
  'yql=select wpsolr_title from wpsolr30 where (userInput(@query))' \
  'query=hamster'

 "fields": {
                "wpsolr_title": "<hi>Hamster</hi> one"
            }

userInput() with another condition:

vespa query \
  'yql=select wpsolr_title from wpsolr30 where (userInput(@query)) and true' \
  'query=hamster'

 "fields": {
                "wpsolr_title": "Hamster one"
            }

Upvotes: 0

Jon
Jon

Reputation: 2339

The query and configuration described below will return

{ "fields": { "wpsolr_title": "<hi>Hamster</hi> one" } }

That is, the matching term will be bolded with the default markup. It will not generate a dynamic snippet since the field value is too short.

Upvotes: 0

Related Questions