Open Sogl opened 1 year ago
I copied the entire indexConfiguration
method into my class without changing anything.
Now it works but without preview snippet:
I changed getRecord
code very much by looking at the GravPageSearch.php
file:
https://gist.github.com/Sogl/78dce78b254b39a6678f759b3ff981b7#file-flextherapiessearch-php-L84
Still no prieviews/summary. 😞
Example of Flex object in Algolia with all attributes:
Got it working!
First of all, it's a part of default configuration in common-config.yaml
:
search_params.attributesToSnippet:
type: array
label: PLUGIN_ALGOLIA_PRO.ATTR_TO_SNIPPET
default: [ 'content:50' ]
value_only: true
validate:
required: true
This default
line was used for the new index. summary:50
is missing here, which @rhukster has already talked about in another issue about crawl snippets.
Secondly, since a common template is used with already written Vue variables, then searcheable_fields
should be the same:
searchable_fields:
- title
- subtitle
- url
- taxonomy
- headers.h1
- headers.h2
- headers.h3
- headers.h4
- content
As a result, I copied most of the settings from the pages
index.
The only thing I haven't figured out yet is the formation of language prefixes for indexes.
I use this tutorial to create custom class for my Flex objects: https://getgrav.org/premium/algolia-pro/docs/backend#custom-search-classes-advanced
My
getRecord
code (I haven't figured out aboutheaders
andtags
yet):It works for me on the first run. My query results (
bin/plugin algolia-pro query радужке
) for example:Algolia index created fine:
But I can't connect this index to my Learn4-based theme. Steps:
flex
:base.html.twig
:During the debug I found that my index is not connected because there is no
indexConfiguration
method in my search class (AlgoliaProController.php
line 137):Do I need to recreate this method in my class? I don't see it in Docs or in the code of the Reviews plugin.