Hello there,

The module works fine with English and it highlights the English word perfectly, but it doesn't work with Arabic. Am I missing something or is there a particular tweak that will make it work with Arabic text?

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

Component: Miscellaneous » Code
Issue tags: -search api highlight

I don't know any Arabic, and only very little about it, so I'm not sure what the problem here could be. It just seems from a quick search that this isn't an uncommon problem, and unfortunately none of the links I viewed there contained a solution.
I guess you could try to post your question on StackOverflow or in the Solr mailing list, provide as much details as you can, and hope someone more knowledgable comes along and is able to help you. Maybe you'll have to adapt Solr's schema.xml to work properly with Arabic.
The only thing I can tell you is that you should disable the "Highlighting" processor on the index's "Filters" tab, since that doesn't work properly in conjunction with Solr. Or, maybe try to disable "Highlight retrieved data" in the server's settings and instead enabled said processor – maybe the Search API processor will work better with Arabic than Solr's internal one? In any case, always only use one of the two.

PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by module maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty. (In your case, "arabic" seems to be used in several other issues as well, so it might make sense to leave it.)

babusaheb.vikas’s picture

Hi Memoday,
This module is working fine . For this you need to do proper setting of your Search Index. So, make changes as
# Edit you Search Index "config/search/search_api/index/your_search_index_name/edit".
# Click on Filter tab.
#Tick " Highlighting " in the listing.
#Then you will get "Processor settings " below where you can write css for the search text.
#save Configuration.
I implemented a search for Arabic test and its working fine.

Hope this will work for you. Otherwise there will be problem with "schema.xml" or Solr Configuration.

Thanks.

memoday’s picture

Thanks babusaheb.vikas for your reply.

Can you please show me a sample screen shot of what CSS you use in the processor settings. I am using the default <strong>. Can you use a highlight color for example yellow? Is this doable?

Thanks again for your support. I will reindex again and see, but I will wait for your answer first so I don't do it twice.

Thanks again!

babusaheb.vikas’s picture

FileSize
26.14 KB
20.33 KB

Hi Memoday,

I attach two screen shot "processor setting" and "search result". So you can add css accordingly.

I hope this would help you.

memoday’s picture

Thank you so much for your kind attention and support. I really appreciate it. I didn't know that you can apply yellow highlighting. This is really useful. Thanks a million!

memoday’s picture

FileSize
100.71 KB

I followed the tips provided here and it seems this doesn't work in views for some reason. Please see attached screen shot. I added the search:excerpt field to my view, but it gets displayed in a separate column. I see that my search is highlighted in the excerpt column, but not in the node itself. How can I make highlight work in all other columns?

Thanks again for your help!

memoday’s picture

FileSize
101.52 KB
34.08 KB

Instead of opening a new issue, I am following up here on this issue that is driving me crazy.

Here is my latest findings and I hope someone can help me out.

1) I see that that the search excerpt is returning highlighted text. I am using the table format in my view, but the Search Excerpt column is added to the table view and it's the one that has the text highlighted. I want the highlighting to be in the nodes themselves, i.e. the 'source', dictterm_title', 'target' columns. Please see screen shot '01_excerpt.png'.

2) I used the Search API page module and this displayed highlighting perfectly. Please see screen shot '02_search_page.png', but I have no control over the display. I would like to display the results in table format and hide the field names, but there is no way to do. Am I missing something here?

What could be the reason of this issue? What should I change or try differently to fix the highlighting issue?

Thanks again for taking the time to read this.

drunken monkey’s picture

This is really a different problem than the original one and should be dealt with in a new issue – but since this is your issue and no-one else has reported with the same problem here, I guess we can make an exception in this case.

The first question is: in the Solr server settings (in Drupal), did you enable both "Retrieve result data from Solr" and "Highlight retrieved data" under "Advanced"?

If you did, and it still doesn't work, see the caveat in the handbook.

For Search API Pages, there's no built-in way for a different output format. If you want a table, your only option is to set its "View mode" to "Themed as search results" and then override the search-api-page-results.tpl.php and search-api-page-result.tpl.php templates in your site's theme. (It's also possible to only override it for a specific search page by appending the page's machine name.)

memoday’s picture

Hi Thomas,

I managed to make it work for Arabic, but when I use

<strong><font style="color:#0000FF">
</font></strong>

in the Highlighter settings, the yellow background spans over the whole text after the keyword found.

Where in the solrconfig.xml file can I add the yellow background?

thanks

drunken monkey’s picture

I'm afraid this is currently not configurable. We actually use [HIGHLIGHT]^[/HIGHLIGHT] as the tags in the Solr request and then manually transform these to <strong> tags to be able to sanitize the field's HTML. Adding an option for the tags to use instead of hard-coding <strong> wouldn't be too difficult, but just wasn't done yet, so currently changing this would be rather hack-y and require custom code of some way or other.

OanaIlea’s picture

Status: Active » Closed (outdated)

This issue was closed due to lack of activity over a long period of time. If the issue is still acute for you, feel free to reopen it and describe the current state.