it seems like Solr can, at least in some situations, ignore the request, if the q parameter is missing.

We should set one by default.

Comments

tlyngej created an issue. See original summary.

tlyngej’s picture

StatusFileSize
new577 bytes

This is one way of fixing it. There might be a better way though.

jmdeleon’s picture

Seems like a reasonable check to do, and a simple way to handle the situation. Any suggestions as to how this can be tested?

tlyngej’s picture

My use case was a Solr 4.7.2, using the DIH mail config. But I'm not sure if it is a general thing. But I assume not, as I guess more would have complained about it. :-)

jmdeleon’s picture

That's great, thanks! (for the follow-up and the patch)

  • jmdeleon committed 202dbab on 7.x-1.x authored by tlyngej
    Issue #2546086 by tlyngej: Missing query can cause Solr to ignore the...
jmdeleon’s picture

Version: 7.x-1.1-beta6 » 7.x-1.x-dev
jmdeleon’s picture

Status: Active » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2546086-missing-query-2.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2546086-missing-query-2.patch, failed testing.

jmdeleon’s picture

Version: 7.x-1.x-dev » 7.x-1.1-beta6

Status: Needs work » Needs review
dcam’s picture

Just FYI, versions of Sarnia prior to our recent work wouldn't have had this problem. It was the removal of the hard-coded requestHandler names that caused certain configurations to not return results without a search. You'll see in that comment that I noted the standard requestHandler would not return any results by default because the $call_args['query'] = '*:*' was removed.

I didn't really consider it a problem because I figured people could adjust their requestHandler config to return all results by default. This makes me wonder what is better (although I realize the patch has already been committed). Is it better to hard-code the module to return all results by default to avoid any confusion that might be caused by empty result sets? On the other hand, is there a use case that we're preventing where someone might not want all records to be returned? Therefore, is it more responsible to leave the configuration up to the admin in their Solr config files? I don't know the answer to those questions. My instinct says "we probably should leave that up to the Solr config." At least that is mitigated by the fact that you can configure Views to not display anything if a search has not been performed, so there is an easy workaround.

Anyway, configuring the module to use the standard requestHandler should be the easy way to test if this patch works. Use the Drupal Common Config files, set the Sarnia server config requestHandler to "standard", then test to see if it returns no results by default (without a search being performed) before the patch and then see if it returns results afterward.

tlyngej’s picture

Right, maybe a revert of this patch might be in order then. I thought that this was related to the old version of Solr.

Let's say that I'm not in control of the Solr instance running this core. And the core isn't setup with any kind of Drupal in mind. Would there be any way to verify whether the server is specifically set to return no result, if the query is empty?

Could we maybe add a setting in the Sarnia setup that allowed Drupal to either respect this or override it?

jmdeleon’s picture

dcam: I guess that's what dev version builds are for :)

I kind of like the idea of having an interface for a default query. When this patch was first submitted, the thought ran through my mind that making an assumption on the default query behavior might not be the best thing, but there is also the case where one might not be in control of the source Solr core, and might have to mitigate against it.

jmdeleon’s picture

StatusFileSize
new1.36 KB

Here's a proposed patch that puts an interface to the default query parameter in the Sarnia server settings.

jmdeleon’s picture

Status: Needs review » Needs work

The last submitted patch, 17: 2546086-missing-query-16.patch, failed testing.

jmdeleon’s picture

StatusFileSize
new1.33 KB

Re-rolling patch in #17 to use Unix-style line endings.

jmdeleon’s picture

StatusFileSize
new1.46 KB

Patch in message #20 (mis-labeled as #18) returned an error, when re-saving a Sarnia index (and not a server entity). This patch remedies that error.

jmdeleon’s picture

jmdeleon’s picture

StatusFileSize
new1.33 KB

Fixed paths in #21 and re-rolled, in case some people had trouble applying.

  • jmdeleon committed 487fe05 on 7.x-1.x
    Issue #2546086 by jmdeleon, tlyngej: Missing query can cause Solr to...
jmdeleon’s picture

Committing the patch in #23 to dev. Adding the default query allowed a lot of the demo cores that come with Solr to work and display Views, as tlyngej noted with the Solr mail demo core. It had been a stretch goal of mine to get the "techproducts" db DataImportHandler demo working that was included with Solr, and I was able to get it displaying Views properly with this series of patches. #23 incorporates the originally submitted patch, plus adds a UI to the Sarnia server config to override the default query, if that is ever needed.

jmdeleon’s picture

Status: Needs work » Reviewed & tested by the community

The last submitted patch, 20: 2546086-missing-query-18.patch, failed testing.

The last submitted patch, 21: 2546086-missing-query-21.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 23: 2546086-missing-query-23.patch, failed testing.

jmdeleon’s picture

Version: 7.x-1.1-beta6 » 7.x-1.1-beta7
Status: Needs work » Closed (fixed)
tlyngej’s picture

Splendid work! (highfive)