Jump to content

SearchEngine


teppo

Recommended Posts

Hello,

first of: thank you for this great module 🙂

I have implemented it more or less successfully. But I've hit a wall. I've tried generating the code with JSON, manually or with the default setup, where the module handles everything. And no matter what I try, I don't get a summary to work. I will receive title and url, but no summary. I am using Multilanguage (with de and en) and most fields are RepeaterMatrix.

German and Englisch works fine, Multilanguage works on the titles and urls.

But I don't receive any kind of summary in the code.

I've checked and rechecked the documentation, but I didn't find a solution for it.

Link to comment
Share on other sites

15 minutes ago, GedankenSchmiede said:

But I don't receive any kind of summary in the code.

I've checked and rechecked the documentation, but I didn't find a solution for it.

The "summary", just in case this was overlooked, isn't (entirely) an in-built feature for the module. It needs to be told what field in your template(s) will be used for the search result summary when rendered. From the documentation on the Modules page, under the "Options" heading, check the render_args property of the module's config, and look for the below:

// Summary of each result (in the search results list) is the value of this field.
'result_summary_field' => 'summary',

In the config, the "result_summary_field" points to the field used in your instance of ProcessWire this module is being used in that will be used to render the search result template's summary. So if in your templates you either don't have a summary field, or the field you use to define a summary is named differently, you'd need to use whatever value you have for your template(s). If maybe you used something like "short_description" as a page summary field, go with that. If you don't have a summary, you could use a "body" or "content" field, and in the render template use some form of string truncation, such as sanitizer()->truncate($your_summary_field, 80).

If you're using JSON, slightly further down is a different section for that:

// These settings define the fields used when search results are rendered as JSON.
'results_json_fields' => [
    'title' => 'title',
    'desc' => 'summary',
    'url' => 'url',
],

Does that help at all?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...