Coder Social home page Coder Social logo

Comments (7)

CaroFG avatar CaroFG commented on July 18, 2024 1

The second issue described is also an expected behavior, when you use phrase search (you enclose your query terms in ") Meilisearch will return documents containing all those query terms. In your case, documents containing both bot and test.

If you want to find all documents containing bot and/or test, you should not enclose them in double quotes:
client.index('movies').search('bot test').then((res) => console.log(res))

from meilisearch.

curquiza avatar curquiza commented on July 18, 2024

Hello @anh1

This is an expected behavior. Indeed, there is a special case with the « . » and the « , » due to the « number » support like « 1.2 ».
When there is no space after « . » or « , » the separator is not considered a context separator (aka hard separator). However, putting a blank space after the separator will be considered as you expect

For instance
octavia.butler -> "octavia butler"
octavia. butler -> "octavia" "butler"

from meilisearch.

anh1 avatar anh1 commented on July 18, 2024

octavia. butler

when i run client.index('movies').search('bot test').then((res) => console.log(res)), i get 2 results.
when i run client.index('movies').search('test bot').then((res) => console.log(res)), i get 219 results.
should both run return the same amount documents?

from meilisearch.

CaroFG avatar CaroFG commented on July 18, 2024

Meilisearch uses by default the "last matching strategy": it returns documents containing all the query terms first, then Meilisearch will remove one query term at a time, starting from the end of the query.

For client.index('movies').search('bot test').then((res) => console.log(res))
It will first search for documents containing both query words, 'bot' and 'test', then it will search for results containing just 'bot'.

For client.index('movies').search('test bot').then((res) => console.log(res))
t will first search for documents containing both query words, 'bot' and 'test', then it will search for results containing just 'test'.

You can fin more info on matching strategy in the documentation

from meilisearch.

anh1 avatar anh1 commented on July 18, 2024

Meilisearch uses by default the "last matching strategy": it returns documents containing all the query terms first, then Meilisearch will remove one query term at a time, starting from the end of the query.

For client.index('movies').search('bot test').then((res) => console.log(res)) It will first search for documents containing both query words, 'bot' and 'test', then it will search for results containing just 'bot'.

For client.index('movies').search('test bot').then((res) => console.log(res)) t will first search for documents containing both query words, 'bot' and 'test', then it will search for results containing just 'test'.

You can fin more info on matching strategy in the documentation

Okay. But from a user perspective, when I type in "bot test" or "test bot", I expect all documents containing test or bot to be returned. I wouldn't think the result would contain only "bot" and not "test" or vice versus. If I do a search "bot test", and only receive 2 results containing "bot", then I would assume there are no movies with the word "test" in it which is not the case.

from meilisearch.

CaroFG avatar CaroFG commented on July 18, 2024

Hey,

You are not the only want that would like another behavior. In fact, we have an open product discussion about the subject.

There are currently two matching strategies: all and last. In the discussion linked above, there are others listed, it would be great if you could give your opinion/vote, it greatly helps us shape the product and prioritise features 🙏

from meilisearch.

CaroFG avatar CaroFG commented on July 18, 2024

Since both of the issues described align with the expected Meilisearch behavior, I am going to close this issue. Thank you for bringing this to our attention 🙏

from meilisearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.