meilisearch / meilisearch-php

PHP wrapper for the Meilisearch API

Home Page:https://meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value'

francoism90 opened this issue · comments

Description
I'm using Meilisearch together with Laravel Scout (both latest versions).

More frequently, the query gets broken, because the search didn't return any documents:

�thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', milli/src/search/new/ranking_rule_graph/proximity/compute_docids.rs:241:57
�thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', milli/src/search/new/ranking_rule_graph/proximity/compute_docids.rs:241:57
�thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', milli/src/search/new/ranking_rule_graph/proximity/compute_docids.rs:241:57

Expected behavior
Do not break on non results.

Current behavior
See log above.

I'm not an expert, but it seems to happen when using additional filters, like this:

Book::search('This query does not give any matches')
    ->take(10) // this may be the issue, as it seems to parse non results, resulting in a panic
    ->keys()

I don't know if this is an engine failure, or this belongs to the PHP wrapper.

Screenshots or Logs
If applicable, add screenshots or logs to help explain your problem.

Environment (please complete the following information):

  • OS: Docker/Podman
  • Meilisearch version: v1.3.0
  • meilisearch-php version: v1.3.0

Hi @francoism90

Do you know if you make the same query in the curl, you will have the same result?

@brunoocasali No, I don't get any error when using curl instead:

curl \
  -X POST 'http://localhost:7700/indexes/books/search' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MyMasterKey \
  --data-binary '{ "q": "thisdoesnotexists", "limit": 5 }'

Do I need to call additional parameters?

I'm not sure you should... I'll ping @mmachatschek to see if he knows of any possible issue regarding using the new meilisearch with scout.

I don't know of any incompatibilities with scout in this area.

The stacktrace shows some issue with the proximity ranking rule. Maybe that is an issue.

Does it return a different result when you don't use take(5)?

Book::search('This query does not give any matches')
    ->raw()

Also can you post your index settings and if you've overridden any Searchable trait methods?

@mmachatschek @brunoocasali I found the issue, the word and:

> Book::search('Foo and Bar')->keys();

   Meilisearch\Exceptions\ApiException  task 4910 panicked.

I can reproduce the same thing with curl.


But I found the issue.. I'm using custom synonyms in config/scout.php:

'&' => ['and'],
'and' => ['&'], // removing this, fixed the issue.

So yeah, user error lol, but do I still need to define '&' to match 'and', or does this work perfectly fine?

Thanks, and sorry for noice.

Hi @francoism90 just letting you know, this is a confirmed bug on the engine: You can track it here: meilisearch/meilisearch#3977

I'll close this issue now, thanks a lot for your report!