The Stemmer processor should have a supportsIndex() which checks whether English is actually one of the site languages. If not, the processor shouldn't be available at all, it's just confusing.

Comments

drunken monkey created an issue. See original summary.

joseph.olstad’s picture

hmm? I've got french and english enabled, I don't see any stemming options?

looking for stemming options in search api.

drunken monkey’s picture

Issue tags: +Novice

It’s on the search index’s “Processors” tab.

joseph.olstad’s picture

we need stemming for French also.

I'm currently having issues making English stemming work.

added a text field and stemming isn't happening on it

example:
smartphone

when I search for smartphones I don't get smartphone

tried to add smartphones=smartphone

that didn't help either

protection and protect same issue

using database search not apache solr

although I'm using 8.x-1.19

I'll try 8.x-1.x dev and see if that helps

joseph.olstad’s picture

for french, I can just do the same thing we do for stopwords, add them to the list on different lines after the english

however neither english/nor french stemming seems to be working right now

mkalkbrenner’s picture

Switch to the Search API Solr backend to get stemming for other languages and full multilingual support.

@drunken monkey, I think that we should state something like that on the Search API project page.

joseph.olstad’s picture

***EDIT*** / stemming from within my solr core very similar to out of the box config is working nicely, but somewhere inbetween the /search/node page ui and solr the query isn't getting processed for stemming as I'd expect *** END EDIT ***
ok I've switched to using a Search API Solr backend, still working on stemming setup/configuration.

what I would like to do is have this filter work on all text fields not just one, I don't see much documentation on the web for this:
<filter class="solr.EnglishMinimalStemFilterFactory"/>

so for example, when I search for cellphones I expect to find results with the word "cellphone" but am not yet able to using the Drupal ui

when I search for protecting I expect to find 'protect' results

I'm working on this right now, with varying degrees of success.

Seems that if something works in the solr query interface it doesn't necesarily work in the Drupal search interface.

I may have to really dig deep into the module code to understand how this works.

joseph.olstad’s picture

joseph.olstad’s picture

so far, I found some really old stackoverflow stuff that talks about setting the qf query value in a hook
I recall doing this about 5 years ago with solr , it's been a while.

Now there's an event for the hook in search_api and they deprecated the hook

but in search_api_solr it has the hook which is apparently not deprecated

I looked at the stemming documentation for search_api and only found two paragraphs

joseph.olstad’s picture

I'm bouncing around trying to find an example and I found this module that might help:

It's called snowball_stemmer and apparently works with search_api and the db search, so I will test this and if it works for stemming I'll use db search instead of solr (for now).

joseph.olstad’s picture

ok snowball stemmer didn't do it for me

I'm still looking into solr , but found this:

the search interface I'm using did not trigger the hook_search_api_solr_query_alter()
and did not trigger hook_search_api_solr_converted_query_alter() as I was expecting.

however, when I went to the search index page, these two hooks did get triggered.

The stemming is working in solr but not in my search interface, still investigating.

joseph.olstad’s picture

I've got a solr instance , stemming works fin inside solr, but not through the node/search page, I am led to believe that I have to implement a "qf" parameter on a query alter but the hooks didn't invoke where I expected except on the search index page and not the node/search page.

with that said, I noticed that the search_api stemming options are Discouraged for a solr instance, so I disabled it. Going around in circles.

When I enabled the snowball_stemmer module I got zero results after reindexing and reviewing several times.

so then I went back to db search and tried that again instead of solr, same result.

I got the same result with search_api_solr also, query of a root word that is clearly already stemmed in the solr index did not work through the search/node page key param.

I seem to recall having a lot more success using Drupal 7 and search_api / search_api_solr

joseph.olstad’s picture

I will try enabling search_api_solr_devel to see if this can help debug

I should also probably open an issue for this in search_api_solr instead of hijacking this issue.

mkalkbrenner’s picture

Category: Feature request » Support request

When you use Solr as backend you have to disable Search API's stemming processor!

Stemming works perfectly well without implementing any hooks or manipulating the query parameters.
You just need to set the filed type to "Fulltext" when managing your indexed fields.
There's also an "unstemmed" fulltext field type that could be used for the one filed you don't want to use stemming for.

joseph.olstad’s picture

Hi @mkalkbrenner, hmm yes I noticed the warning to disable the search api stemming processor which I did try however I didn't look at the field type setting.

I will investigate if I can somehow change the field type setting for the search/node page query/and results however the search_api_solr_devel debug mode didn't show any kint debug information on the search/node page only when indexing and from the server status page.

Thanks very much for your feedback I will look at this again.

joseph.olstad’s picture

ok, I checked my field settings, they're all set to 'Fulltext'

I'll continue to investigate however the /search/node page doesn't seem to use the 'Fulltext' value. I'm confused how to debug the /search/node page because the mentioned hooks are not invoked for this page. Perhaps an event thrown by search_api will need to be modified to get the expected search results in the /search/node page whereas in solr it'self the stemming is working.

joseph.olstad’s picture

I'm currently evaluating the dev releases of search_api and search_api_solr
for some reason 4.12 of search_api_solr isn't yet available from composer. must be a delay in packagist.org at the moment.

joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
drunken monkey’s picture

Title: Hide the Stemmer on non-English sites » Problems with French stemming
Issue tags: -Novice

Do you have the Core “Search” module enabled, too? That’s normally what’s supplying the /search/node page, and if that’s the case it’s no wonder Search API and Solr are not touched at all.

Also, this issue was actually about something other than your stemming problems, it would have been polite to create a new issue.
Now it’s probably simplest to just let you have it – created #3220988: Hide the Stemmer on non-English sites for the original issue.

joseph.olstad’s picture

Hi yes I figured that out the hard way, helps to read the documentation first, ya I had to uninstall the core search module and create a new search page using search_api_pages

thanks for your work on these modules, great stuff.

The english stemming seems to work well with search_api_db however I didn't see what I would have expected for french. Like verb conjugaison arrêtez should stem to arrêt. With that said, french language stemming worked pretty much out of the box when using search_api_solr and solr as a search engine using the recipe core cooked up by search_api_solr . I tested with solr v8.8.2.

I am impressed with what can be done with search_api_db , works very well! With that said, my client decided to push for solr so I ended up switching to solr v8.8.2.

Very impressed with this suite of modules! Great work, I have managed to overcome most challenges of setting it up. When I have more time I'll try to contribute more feedback and possibly some patches also.

I'm pretty much using out of the box options for the most part. not getting too fancy yet but am using facets. Getting nice results with "multiword messy" in the fulltext search filter options using search_api_solr, I'm not sure if this option was available with search_api_db but will double check later.

joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned

unassigning myself 'for now'.