Comments (6)
I just had to use Person.search("Bob Dylan", fields: [:first_name, :surname, :other_name], partial: true)
from searchkick.
Cool, you could also create a new field with the search data method
def search_data
{
full_name: "#{first_name} #{surname} #{other_name}"
}
end
And use that field to search.
from searchkick.
Would that be a method on the searchable class?
from searchkick.
Yeah, Person in your case. If you want to keep the existing attributes, use:
class Person < ActiveRecord::Base
def search_data
to_hash.merge(full_name: "#{first_name} #{surname} #{other_name}")
end
end
And call:
Person.first.search_data
To see an example of what will be indexed.
from searchkick.
Awesome. Thanks! 👍
from searchkick.
What if I would like to search the child model fields?
from searchkick.
Related Issues (20)
- new option to ignore search_import HOT 5
- Configure client_type per index HOT 2
- Customize searchkick reindex queue per model HOT 1
- should_index? is not checked on delete callback HOT 3
- Unscope the search_import scope in-case I'm indexing some attrs, HOT 2
- Faraday unable to connect to opensearch
- Routing not working HOT 3
- Unscope the search_import scope in-case I'm indexing some attrs,
- Issue using operator OR and Elasticsearch 8 HOT 1
- MyModel.reindex causing index [INDEX_NAME/UUID] already exists with elasticsearch 8.x only (not 7.x) HOT 1
- Support double indexes HOT 1
- Ruby 3.0 being overtaken error due to use of class variables HOT 1
- Explicit synonyms do not work HOT 1
- Add documentation for client_options HOT 1
- Lazy load not working HOT 2
- named query search example (_name) HOT 1
- Feature Request: Implement none Method HOT 3
- Scoped include in search_import not being loaded HOT 1
- Unable to index model with composite pk HOT 1
- `scroll_each` API to work with batches like `find_each`
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 searchkick.