Comments (4)
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.
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.
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.
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)
- Ignoring MySQL stop words for full-text search HOT 5
- Support for PostgreSQL ENUM HOT 3
- Matching multiple in a has_many HOT 1
- multiple where conditions and concatenated with AND HOT 3
- Attribute (case insensitive / ILIKE) HOT 3
- generator for attribute options HOT 3
- Error when using with non-standard pluralization in class name HOT 2
- DEPRECATION WARNING HOT 2
- Suggestion: Option for `exact: true` (or `right_wildcard: false`) HOT 1
- Can search_cop work with Postgres hstore? HOT 8
- Suggestion: Add support for sort in the free text search HOT 4
- Searching for empty or non empty with the free text expression HOT 2
- RAILS 6 - Search in ActionText HOT 3
- Search word that include % does not work correctly HOT 2
- Ability to apply Custom Operators or Options to entire project HOT 1
- ActiveRecord::ConfigurationError in v1.2.1 HOT 10
- README error? HOT 6
- Words containing brackets HOT 4
- Add passkeys / 2FA support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from search_cop.