Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Search by entire phrase? #182

Closed
dzg opened this issue Oct 1, 2021 · 3 comments
Closed

Search by entire phrase? #182

dzg opened this issue Oct 1, 2021 · 3 comments

Comments

@dzg
Copy link

dzg commented Oct 1, 2021

Is there any way to make this search for the entire input string, rather the words?

E.g., if I search for "let it roll", I get results for all posts which contain those 3 words, anywhere, in any order.
I want to find posts which contain the actual string "let it roll".

@dzg
Copy link
Author

dzg commented Oct 1, 2021

I was able to accomplish this by changing src/SearchStrategies/LiteralSearchStrategy.js
to

function LiteralSearchStrategy() {
   this.matches = function (str, crit) {
      if (!str) return false
      str = str.trim().toLowerCase()
      crit = crit.trim().toLowerCase()

      return str.indexOf(crit) >= 0
   }
}

but I would vote for having this be a search option.

Thanks! Awesome plugin!

@dzg
Copy link
Author

dzg commented Oct 2, 2021

... or instead of a flag, it could be triggered when the search input begins/ends with " ... like a Google search...

@dzg
Copy link
Author

dzg commented Oct 2, 2021

I just realized this was already implemented in 2df6280 but it hasn't been compiled to /dest yet

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants