I have a use case where i want to be able to search for all fulltext fields but don't show all of them in the search excerpt. For example including node type in search excerpt gets a bit wierd showing both machinename and humanfriendlyname.

I added a setting for excluding fields from excerpt on the hightlight processor form.

This was the easy way, maybe there is a better way?

Comments

Status: Needs review » Needs work

The last submitted patch, search_api_excerpt_exclude.patch, failed testing.

freakalis’s picture

StatusFileSize
new1.75 KB

New patch for testing

freakalis’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: search_api_excerpt_exclude.patch, failed testing.

freakalis’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB

Third time's the charm? :D

freakalis’s picture

StatusFileSize
new1.76 KB

New patch, need to use strict in_array to work as expected.

Status: Needs review » Needs work

The last submitted patch, 6: search_api-excerpt_exclude-2195469-6.patch, failed testing.

freakalis’s picture

StatusFileSize
new1.7 KB

Forgot to make previous patch relative... Here we go again.

freakalis’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: search_api-excerpt_exclude-2195469-8.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new4.37 KB

Thanks for the great suggestion and the already very good patch!
I refactored a bit so the code becomes (hopefully) a bit cleaner, but other than that this was practically good to go.
Please see whether the attached updated patch still works for you and I'll commit it.

  • Commit 1735020 on 7.x-1.x authored by freakalis, committed by drunken monkey:
    Issue #2195469 by freakalis, drunken monkey: Added "Exclude fields"...
drunken monkey’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

drunken monkey’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Closed (fixed) » Patch (to be ported)

Needs to be ported to D8.

drunken monkey’s picture

Issue tags: +Novice
rgpublic’s picture

Added a patch for Drupal 8. Never created or uploaded a patch here before, so pls. bear with me if anything is wrong.

rgpublic’s picture

Oops, small correction: Just because sth. is excluded from the excerpt doesn't mean we shouldnt highlight it. :-)

borisson_’s picture

Status: Patch (to be ported) » Needs review

Setting to needs review, so the bot can have a look at it.

Status: Needs review » Needs work

The last submitted patch, 18: search_api-excerpt_exclude-2195469-18.patch, failed testing.

The last submitted patch, 18: search_api-excerpt_exclude-2195469-18.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new27.55 KB
new25.61 KB

Great job for a first try!
You should probably read up on the Drupal coding standards, but on the whole this is pretty good.
The test fails are most likely due to the missing config schema update – that, some tweaks and an additional test case for this functionality are included in the attached patch.
Thanks for your work!

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reviewing!
Committed.
Thanks again, everyone!

drunken monkey’s picture

Issue tags: +DevDaysMilan

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.