Git Product home page Git Product logo

Comments (4)

mrkamel avatar mrkamel commented on May 26, 2024

hi,

case 1:

you can use a group:

seach_scope ... do
  attributes name: [:first_name, :last_name]
end

but it'll not allow you to search using the mentioned quoted query.
However, you'll be able to search for Model.search("James Bond")

case 2:

currently, i'd try to detect/parse phone numbers and un-prefix them before passing them to search cop.

In addition, recall that you can chain/combine multiple queries:

search_scope :name_search do 
  attributes name: [:first_name, :last_name]
end

search_scope :phone_search do
  attributes :phone
end

and then

Model.name_search('James Bond').or(Model.phone_search(normalize_phone('0123456789')))

from search_cop.

DannyBen avatar DannyBen commented on May 26, 2024

Thank you, but both solutions beat the my purpose. I was looking to provide my users with a single search field, where they can just type advanced queries, and it will be executed in one scope. Sort of like GitHub is doing. So in my case, I wanted users to type in one field:

name:'James Bond' phone:0551234567

After posting this issue, I also noticed that the intuitive syntax for setting exact match did not work. When searching for first_name: bob, we also get users named Bobby, and I was assuming name: "bob" would match exact match, but it didn't.

So, unless I am missing something, I am a bit discouraged about this gem fulfilling my needs.

from search_cop.

mrkamel avatar mrkamel commented on May 26, 2024

hi, unfortunate to hear, but yeah. i try to support as many use cases as possible... In general, search_cop is not a fulltext search unless you tell search cop to use fulltext mode (see readme). In non-fulltext mode it's using LIKE queries and, yes, will match Bobby. I'll consider adding a concatenation option to support the fullname use case, but it'll of course take some time. Same for custom mappers, still.

from search_cop.

DannyBen avatar DannyBen commented on May 26, 2024

Yeah, totally understood. It is still a great gem and I was hoping it can do what I need, since such search is common both in GitHub, and Gmail for example.

In fact, I reached the gem by searching "rails search like github"... :)

Thanks for being cool about it all, I am closing.

from search_cop.

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.