silverstripe / silverstripe-fulltextsearch

Adds external full text search engine support to Silverstripe
BSD 3-Clause "New" or "Revised" License
44 stars 83 forks source link

Apache Solr PHP client sending deprecated waitFlush param #34

Closed madmatt closed 6 years ago

madmatt commented 11 years ago

Using one of the more recent builds of Solr, I've found that I can run the Solr_Configure task, but not the Solr_Reindex task.

If I run the Solr_Reindex, the error I get is:

ERROR [User Error]: Uncaught Apache_Solr_HttpTransportException: '400' Status: Bad Request
IN GET /dev/tasks/Solr_Reindex
Line 364 in /path/to/webroot/fulltextsearch/thirdparty/solr-php-client/Apache/Solr/Service.php

The stack trace is:

Apache_Solr_Service->_sendRawPost(http://localhost:8983/solr/WebsiteSolrIndex/update?wt=json,<commit expungeDeletes="false" waitFlush="true" waitSearcher="true" />,3600)
Service.php:829

Apache_Solr_Service->commit()
Solr.php:209

Solr_Reindex->run(SS_HTTPRequest)
TaskRunner.php:84

TaskRunner->runTask(SS_HTTPRequest)
RequestHandler.php:288

RequestHandler->handleAction(SS_HTTPRequest,runTask)
Controller.php:194

Controller->handleAction(SS_HTTPRequest,runTask)
RequestHandler.php:200

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
Director.php:325

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:143

Director::direct(dev/tasks/Solr_Reindex,DataModel)
cli-script.php:120

The issue is that the XML being sent includes the waitFlush="true|false" param, which apparently hasn't been used since Solr 1.4 (source: https://bugs.php.net/bug.php?id=62332), and in the latest version of Solr has been removed altogether. The Solr logs show the following error:

1612541 [qtp672845127-19] ERROR org.apache.solr.core.SolrCore  ? org.apache.solr.common.SolrException: Unknown commit parameter 'waitFlush'
    at org.apache.solr.handler.RequestHandlerUtils.validateCommitParams(RequestHandlerUtils.java:85)
    at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:263)
    at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:174)
    at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1859)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:703)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:406)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:195)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:368)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1014)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
    at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:695)

I haven't yet checked if there's an updated version of the thirdparty module - but just wanted to log this issue so if others find the same issue, they at least know what needs to be changed. I was able to fix the issue by just changing line 827 of fulltextsearch/thirdparty/solr-php-client/Apache/Solr/Service.php and removing the waitFlush param entirely, but that's obviously only a temp fix until we can update the library :)

madmatt commented 11 years ago

More info regarding its deprecation: http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22commit.22_and_.22optimize.22

madmatt commented 11 years ago

Further review suggests that this still an issue in the latest solr-php-client library (source: https://code.google.com/p/solr-php-client/source/browse/trunk/Apache/Solr/Service.php#852) which means we'd have to fix it there and then get the latest version of the code for this project.

There is an open enhancement issue on the issue tracker for the project here: https://code.google.com/p/solr-php-client/issues/detail?id=75 which has been open since 2012.

There is also a patch here: https://code.google.com/p/solr-php-client/issues/detail?id=91 which adds commit4() and optimize4() methods which don't include the waitFlush commands, but that hasn't been accepted yet (and isn't a great solution anyway).

hafriedlander commented 11 years ago

I've been looking at Solr 4.5 compatibility, and have a patch I need to tidy up. I'll try and update this week.

jkRoberts commented 10 years ago

Hey guys,

Just wondering if there has been a fix on this yet?

Being that we are getting this error from the CWP basic recipe, will this also cause an issue there?

peavers commented 9 years ago

This Issue has cropped back up with only one of our builds... unsure why as all builds are using the same solr version, and framework versions...

org.apache.solr.common.SolrException: Unknown commit parameter 'waitFlush'
dhensby commented 6 years ago

Nothing on this for almost 3 years - is it still a bug? I'd have expected to hear a lot more on this if it were...

madmatt commented 6 years ago

Yes this was fixed with @ss23's PR (#60).