New answers tagged

0

None of the relations information is stored in C, so when you have C views it can't show relations info out-of-box. Usually the way to show the "Child" for a "Parent" node is by using the Contextual filter for the Entity Reference field with the "provide default value" and "Content ID from URL" options. In your case A is a child of B, and B is a child of C....


1

Just found this old post while debugging the same issue. Adding my fix in case other hit it too.. The problem I ran into using the sample code was this line: // Do paging. $query->range(20, 10); I since I only had a few records in my database, there wasn't 20+ records, the total count was correct, but couldn't page that far. Updating to: // Do paging....


0

You can manually edit this limit in the search_api_views module source file. You find this here in the commerce kickstart bundle: /profiles/commerce_kickstart/modules/contrib/search_api/contrib/search_api_views/includes/display_facet_block.inc Then you correct the limit of 10 on line 167 of display_facet_block.inc $limit = empty($this->view->query-&...


0

Facets are usually used for a lot more complex examples with many properties to narrow down your search by. Both facets and the usual Views with Exposed filters form create paths that hold search parameters entered by users. The simplest case would probably be to add the textual filter for the Body field, and the Filter for the Taxonomy reference field, ...


-1

I have a question: How to highlight the keywords in search results and show excerpts according to the keywords? I have implemented the above comments. Any solutions?


0

I missed it earlier, but it turns out that Search API just exposed the Excerpt field to view modes. Updating Search API to 8.x-1.x-dev and a cache rebuild gave me the functionality I need.


0

Search API filters and results are displayed using views - so you need to override the views template. So if you create a view page for your search called "Search API" (search_api) - and the machine name of that view is page - then you can add the following file to your theme: my_theme/templates/views-view--search-api--page.html.twig You probably want to ...


0

You can replace empty search message by call custom block body by: Go to /code/themes/THEMENAME open THEMENAME.theme file and add following Hook As: function THEMENAME_preprocess_item_list__search_results(&$variables) { $custom_block = \Drupal::entityTypeManager()->getStorage('block_content')->load('BLOCKNUMBER'); $fieldcontent = $...


0

this module can probably help some of you. https://www.drupal.org/project/search_api_glossary It is working on D7 and D8. Have a good day.


1

Since everyone was telling me to solve this during the query, I decided to have another look at this approach. My main issue was not being able to order by the flagged status, which was eventually solved with an expression. In the end I managed to get what I wanted with an implementation of hook_search_api_db_query_alter. function ...


1

Depending on your setup there are different reasons why you can get duplicates. A common reason is, that you're using related entities (nodes, taxonomies). Let's say you got a content type car with a taxonomy term that shows the car's color. If you create a relationship between car and color in your view, you can see duplicates if a car has multiple colors. ...


1

I did a quick test and found the same as you, i.e. updating the relevance score worked, but the view sort did not seem to take the updated relevance into consideration. As @zaporylie pointed out in the comments, sorting is done in query rather than display, but I'm not sure why the sort you specify in the view settings is not being honoured. A quick ...


Top 50 recent answers are included