Skip to content

Search doesn't work #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kentr opened this issue Jan 26, 2016 · 2 comments
Closed

Search doesn't work #5

kentr opened this issue Jan 26, 2016 · 2 comments
Assignees
Labels

Comments

@kentr
Copy link
Collaborator

kentr commented Jan 26, 2016

Problem/Motivation

Node search form submissions return the same results every time. Even changing the values for keys in the query string doesn't work as expected.

To repeat

  1. Submit a standard basic node keyword search.
  2. Note the results.
  3. Submit a new search with different keywords. The results are the same as for the first search.

Proposed resolution

Set $request->server params correctly.

The problem appears to be that $_SERVER['QUERY_STRING'] doesn't contain the query string.

In \Drupal\Core\Routing\RouteProvider::getRouteCollectionForRequest(), a cached version of the request URI without the query string (in this case, search/node) is getting served because $request->getQueryString() is empty:

    $cid = 'route:' . $request->getPathInfo() . ':' .  $request->getQueryString();
    if ($cached = $this->cache->get($cid)) {
      $this->currentPath->setPath($cached->data['path'], $request);
      $request->query->replace($cached->data['query']);
      return $cached->data['routes'];
    }

Remaining tasks

  • Research whether ReactPHP assembles an analog to $_SERVER.
  • Apply fix.
  • Test.
  • Submit pull request.

API changes

The interface shouldn't change, but the values available through $request->server->get() should more accurately reflect a standard PHP server environment.

See also

@kentr kentr self-assigned this Jan 26, 2016
@kentr kentr added the bug label Jan 26, 2016
@kentr
Copy link
Collaborator Author

kentr commented Jan 26, 2016

I didn't see anything in React that looks like it passes these values separately from \React\Http\Request::$query, etc.

So, looking at setting these manually in the PHP-PM request handler.

Setting QUERY_STRING in \PHPPM\Bridges\HttpRequest::mapRequest() appears to fix the search form problem.

@kentr
Copy link
Collaborator Author

kentr commented Feb 16, 2016

This should resolved with the inclusion of the Drupal bridge \PHPPM\Bridges\DrupalKernel that uses SymfonyRequest::create().

@kentr kentr closed this as completed Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant