Excerpt shows all fields even when only one field has the searchterm

Created on 7 February 2019, over 6 years ago
Updated 7 July 2025, 8 days ago

Hi,
when:

  • I use the excerpt in my view
  • In the index=>processors=>Highlight=>Exclude fields from excerpt: I have not checked Field A and Field B
  • I have checked Field C (so it´s excluded)
  • I search for "searchterm" which is in Field A and not in Field B
  • Field A AND Field B is displayed in the excerpt

Expected behaviour:
Do not display fields in my excerpt that does not match with "searchterm".

Furtheron:

When Field B has multiple values - for example when Field B is the linkname in a referenced entity, and there are 4 entities attached, the excerpt will show all 4 linknames. Only thing needed is
- a match of "searchterm" in one of the referenced linknames
- or a match of searchtearm in Field A

But maybe: Someone wants to display a field in the excerpt as a standard output - even when this field has no match. If this was the intention it´s not working fine also. Because:
When I do not have ANY matches of "searchterm" in one of the unchecked fields:
Those unchecked fields are not displayed.
For example: "searchterm" is in Field C : the excerpt is empty.
If someone wants to have a standard output of a given field, which has no match, he should put this field into his view or use replacement patterns in the rewrite results section of the views excerpt field.

I try to make a figure:

in SOLR, this is how my linkname field is stored (In Our example "Field A"). The linkname field is part of the node attached via entity reference field:
( Entity Reference Field) » Content » Call to action » Link text (title_3)

"tm_X3b_en_X2d_SG_title_3":
          ["CTA1BCDshowertest",
          "Learn more CTA2",
          "Learn more CTA3a",
          "CTA 5a"],

When I search for "showertest", the excerpt displays:
CTA1BCDshowertest … Learn more CTA2 … Learn more CTA3a … CTA 5a … Learn more CTA4a … Learn more CTA4b … CTA 6a … CTA7a … CTA8a …

The italic part is coming from my Field B:
( Entity Reference Field) » Content » (Field in the attached node) » Paragraph » Call to action » Link text (title_5)

"tm_X3b_en_X2d_SG_title_5":
          ["Learn more CTA4a",
          "Learn more CTA4b",
          "CTA 6a",
          "CTA7a",
          "CTA8a"],

And when I have a match in Field C - in my case it´s the summary field: The excerpt is empty.
(Summary (field_summary)):
"tm_X3b_en_X2d_SG_field_summary":["Teaser Showertest ...stripped text..."],

Here´s the spell of this node:

spell":["Teaser Showertest ...stripped text...",
          ...stripped other fields...
          "CTA1BCDshowertest",
          "Learn more CTA2",
          "Learn more CTA3a",
          "CTA 5a",
          "Learn more CTA4a",
          "Learn more CTA4b",
          "CTA 6a",
          "CTA7a",
          "CTA8a"],

How can i make it, that only the values are in the excerpt which have matched "showertest" ?
(the excerpt should display only CTA1BCDshowertest)
Greetings,
Lars

P.S.: I hope i am in the right module and it´s not a search_api or views issue. If it so, forgive me and move to them :-D

🐛 Bug report
Status

Active

Version

1.0

Component

Plugins

Created by

🇩🇪Germany synflag

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • 🇪🇸Spain tuwebo

    I am working on 3031390-excerpt-shows-all-fields fork:
    - Trying to solve handling for the borders between different values/fields
    - Bypassing merging $keys if the backend found $highlighted_keys.
    - PoC: For rendering the excerpt field names as part of the excerpt. It might be useful to know where the excerpt came from.

    Any review/contribution will be very welcome.

  • Pipeline finished with Failed
    5 days ago
    Total: 332s
    #543207
  • Pipeline finished with Failed
    5 days ago
    Total: 453s
    #543277
  • Pipeline finished with Failed
    5 days ago
    Total: 336s
    #543301
  • Pipeline finished with Failed
    5 days ago
    Total: 358s
    #543881
  • Pipeline finished with Failed
    4 days ago
    Total: 357s
    #544296
  • Pipeline finished with Failed
    4 days ago
    Total: 346s
    #544320
  • Pipeline finished with Failed
    about 9 hours ago
    Total: 398s
    #547018
Production build 0.71.5 2024