backdrop-contrib / search_api

Provides a generic API for modules offering search capabilities
GNU General Public License v2.0
0 stars 5 forks source link

Search excerpt not showing highlights from Entity HTML output (search_api_viewed) #17

Closed herbdool closed 3 years ago

herbdool commented 3 years ago

I think it's only indexing the other fulltext fields (for example, I have title which is getting highlighted).

earlyburg commented 3 years ago

Hi herbdool, Can you please provide a bit more info about this? I appreciate your input. Thanks.

earlyburg commented 3 years ago

searchApiScrnsht_2

Since the last update, I have been able to configure Complete Entity View (Full Content) and Highlighting with excerpt. This seems to be working for me as expected. I'll wait a few days for an update from you, and then I will close this. Again, thanks.

herbdool commented 3 years ago

I haven't tried it since I reported it but it does indeed look like you've got it working. So looks good to me! At some point I'll update my local code to match the repos and test again.

herbdool commented 3 years ago

Hm, still not working fully for me. I pulled the latest code for entity_plus, search_api, search_api_db and rebuilt the test site. Perhaps I've got some settings different from you, but not sure what - I've got the same as you above.

earlyburg commented 3 years ago

Ok np. Can you please post a screenshot of what you are seeing perhaps I can be helpful. What aspect is not working on your site? Are you using search_api_page?

herbdool commented 3 years ago

Screenshot from 2020-12-23 09-22-15

This is the view - it was the title and the Search excerpt field. The excerpt is only showing highlights of the title and nothing else. Some of the results do have the search term but they're not highlighting.

In the search index it's set to use search_api_db. Entity HTML output is enabled, set to Fulltext, Full Content view mode. No fields are excluded from the highlighting.

I'm not sure what you mean by search_api_page.

herbdool commented 3 years ago

I had only recently figured out the right combo for displaying this on a d7 site so I think I have it right, but maybe not. (Aside: the documentation on setting up excerpts was quite poor in Drupal. Maybe we could have an extra module with some pre-set configuration for a node index and a view.)

earlyburg commented 3 years ago

https://github.com/backdrop-contrib/search_api_page

Hi @herbdool, From your screenshot I can see you have content in your index and that highlighting is working. Try using the search_api_page module to set up a search page. The module provides page templates that will display your search results properly, along with giving you a bit more control over how the search results and search form are displayed. If you want to create your own UI you can use the page templates in the Search API Page module as a starting point. The screenshot that I posted above was of a search page created with Search API Page module. Please let me know what your experience is with this. I feel that using the correct display templates may be of help with this issue. If this is an issue with views and views displaying the indexed fields correctly - That might be something I can address.

https://vimeo.com/15556855

herbdool commented 3 years ago

Interestingly I get a similar result with search_api_page (I didn't know this module existed till now). At least I know it's not an issue with search_api_views. Must be something to do with the core module. Are you using the current head of the repo @earlyburg or a different branch?

Screenshot from 2020-12-24 08-51-21

herbdool commented 3 years ago

@earlyburg in your screenshot above are you using Solr or search_api_db? I'm using search_api_db.

earlyburg commented 3 years ago

Hmm, I suspect this may be related to search_api_db. I'm using search_api_solr but I also have a verson of search_api_db working on my local environment. Let me pull a diff between my code and the current branch. More on this soon. Also - thanks for the assistance.

earlyburg commented 3 years ago

@herbdool I took a look at the search_api_db module and looks like the current version works as expected. One thing that I did think about is that it might be possible that you have not indexed the Body text field, but I'm not sure about that unless you give me access to your setup. Check out the options on: /admin/config/search/search_api/index/%myIndexName%/fields All the way at the bottom of that page is a collapsable form element that is labled: "Add related fields". You can use this to index any fields that you might not already have listed. If you still experience difficulties please feel free to update this thread, otherwise I'll close this issue in a day or two.

herbdool commented 3 years ago

Hm, perhaps that is it - I'll try. I had assumed that it was either/or: either index the Entity HTML or index each individual field that could show up in the rendered HTML. (Maybe I should compare it with D7).

herbdool commented 3 years ago

At any rate, we should put some more documentation up. Since even an experienced developer like me is confused by things.

earlyburg commented 3 years ago

@herbdool I agree. Some documentation is definitely on the list of things to do. If you want a field or entity in your search results - you have to tell search api about it. There is a Wiki for documentation now- https://github.com/backdrop-contrib/search_api/wiki If you see something that should be added let me know, and thanks again.