Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic summary not working with query on input field #29219

Closed
eostis opened this issue Nov 3, 2023 · 7 comments
Closed

Dynamic summary not working with query on input field #29219

eostis opened this issue Nov 3, 2023 · 7 comments

Comments

@eostis
Copy link

eostis commented Nov 3, 2023

Describe the bug
Dynamic summary not working with query on input field

To Reproduce

  1. Define a schema field with a summary attribute "wpsolr_title"
field wpsolr_title type string {
     indexing: summary | index
     index: enable-bm25
     summary: dynamic
   }
  1. Define a schema input field "wpsolr_input_text"
field wpsolr_input_text type string {
    indexing: (input wpsolr_text || "") . " " . (input wpsolr__id || "") . " " . (input wpsolr_id || "") . " " . (input wpsolr_title || "") . " " . (input wpsolr_post_status_s || "") . " " . (input wpsolr_content || "") . " " . (input wpsolr_snippet_s || "") . " " . (input wpsolr_author || "") . " " . (input wpsolr_author_s || "") . " " . (input wpsolr_post_author_s || "") . " " . (input wpsolr_type || "") . " " . (input wpsolr_meta_type_s || "") . " " . (input wpsolr_permalink || "") . " " . (input wpsolr_comments || "") . " " . (input wpsolr_categories || "") . " " . (input wpsolr_categories_str || "") . " " . (input wpsolr_category_str || "") . " " . (input wpsolr_tags || "") . " " . (input wpsolr_tags_str || "") . " " . (input wpsolr_post_tag_str || "") . " " . (input wpsolr_blog_name_str || "") . " " . (input wpsolr_post_thumbnail_href_str || "") . " " . (input wpsolr_post_href_str || "") . " " . (input wpsolr_title_s || "") . " " . (input wpsolr_post_sticky_s || "") . " " . (input wpsolr_is_excluded_s || "") . " " . (input wpsolr_flat_hierarchy_categories_str || "") . " " . (input wpsolr_non_flat_hierarchy_categories_str || "") . " " . (input wpsolr_product_visibility_str || "") . " " . (input wpsolr_product_stock_str || "") . " " . (input wpsolr_product_cat_str || "") . " " . (input wpsolr_flat_hierarchy_product_cat_str || "") . " " . (input wpsolr_non_flat_hierarchy_product_cat_str || "") | index
    index: enable-bm25
  }

Expected behavior

  1. Querying wpsolr_input_text should but does not produce a dynamic summary for wpsolr_title
curl -X POST -H "Content-Type: application/json" --data '
{"query":"page", "yql":"select wpsolr_title from index1 where ([{\"defaultIndex\":\"wpsolr_input_text\"}]userInput(@query)) "}
' \
http://localhost:8080/search/

{"root":{"id":"toplevel","relevance":1.0,"fields":{"totalCount":5},"coverage":{"coverage":100,"documents":16,"full":true,"nodes":1,"results":1,"resultsFull":1},"children":[{"id":"index:wpsolr/0/c81e728db67e6fc24b6be56d","relevance":0.31803513173241105,"source":"wpsolr","fields":{"wpsolr_title":"Sample Page"}},...]}}

  1. Querying wpsolr_title should and does produce a dynamic summary for wpsolr_title
curl -X POST -H "Content-Type: application/json" --data '
{"query":"page","yql":"select wpsolr_title from index1 where ([{\"defaultIndex\":\"wpsolr_title\"}]userInput(@query)) "}
' \
http://localhost:8080/search/

{"root":{"id":"toplevel","relevance":1.0,"fields":{"totalCount":1},"coverage":{"coverage":100,"documents":16,"full":true,"nodes":1,"results":1,"resultsFull":1},"children":[{"id":"index:wpsolr/0/c81e728db67e6fc24b6be56d","relevance":0.16343879032006284,"source":"wpsolr","fields":{"wpsolr_title":"Sample <hi>Page</hi>"}}]}}

Environment (please complete the following information):

  • Docker Vespa 8.253.3 self hosted on MacOS
@jobergum
Copy link
Member

jobergum commented Nov 4, 2023

There must be a misunderstanding here.

Expected behavior
Querying wpsolr_input_text should but does not produce a dynamic summary for wpsolr_title

This might be your expectation, but this is not how synthetic fields works.

document doc {
   field foo type string {..}
}
  field foo_derived type string {
    indexing: input foo | something else
  }

Creates a new field foo_derived with the contents from foo and then some transformation. This is the context of indexing. At query time, there is no reference to where or how the field contents was created during indexing.

@eostis
Copy link
Author

eostis commented Nov 4, 2023

I asked because it is a standard feature of Lucene engines that I already use.

Example with OpenSearch:

  • "text" field defined as an input (copied from other fields, like title and description):
image
  • Query on "text" returns highlighting on "title" field:
image

@jobergum
Copy link
Member

jobergum commented Nov 4, 2023 via email

@jobergum
Copy link
Member

jobergum commented Nov 5, 2023

Closing this out - see fieldset if you want to search multiple fields. This also avoids bloating the index by copying data to many field indexes.

@jobergum jobergum closed this as completed Nov 5, 2023
@jobergum
Copy link
Member

jobergum commented Nov 5, 2023 via email

@eostis
Copy link
Author

eostis commented Nov 7, 2023

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants