Problem/Motivation

This is a bit complicated, maybe even a bit more complicated then the summary suggests. I confirmed with SearchStax today their default is changed to dismax. I'll explain the situation triggering this and here's the relevant code that's causing a problem:

https://git.drupalcode.org/project/search_api_solr/-/blob/eb6bf21b8a8051...

Basically we have a view that by default shows all results and then users can search it. Before they search it triggers the above code.

defType is empty and 'edismax' !== $params['def Type'] assumes that the parser is going to be lucene and sends {!boost b=boost_document}. Since SearchStax uses dismax by default this fails to parse and query fails leaving an empty page until the user searches.

Steps to reproduce

Proposed resolution

While this might be a search_api_solr bug, it seems its behavior is more or less reasonable and maybe this module could just alter in a defType or some other interaction? Not really sure, the search_api_solr backen is pretty complex so I'm not sure all the other implications there might be.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

neclimdul created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new5.35 KB

Hi James,

Here, too, sorry for the delay.
Yes, it seems Search API Solr assumes the default is defType=lucene, and as they provide their own config files with this default, I think that’s a fair assumption. As SearchStax uses edismax by default, we should probably just change the query type to lucene explicitly to avoid this whole problem. (Setting defType=edismax would also solve this bug, but as the Search API Solr module works better with the lucene type than with edismax (that’s why they switched – I keep forgetting the exact details, but there are problems in how EDisMax handles searches for multiple words across multiple fields, which they wanted to avoid), I think that’s what we should use.)

Patch attached, please test/review.

neclimdul’s picture

Status: Needs review » Reviewed & tested by the community

Oh hugh. Didn't notice there was a subscriber trying to do this already. That seems like it would have been a better fix it if worked. That's unfortunate. :-/

This is basically the same hack I had just with a few more sanity checks in front of it. Looks great.

  • drunken monkey committed 2ed00df on 1.x
    Issue #3200246 by drunken monkey, neclimdul: Fixed compatibility problem...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Great to hear, thanks for testing/reviewing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.