Skip to content

Search doesn't work #5

Closed
Closed
@kentr

Description

@kentr

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions