Comments (3)
Hi, sorry for delay - I was too busy with my job.
Query with Martin I get all results with Martín, martín, martin, Martin
this is because elasticsearch_autocomplete
use asciifolding filter http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-asciifolding-tokenfilter.html
I think you should define your custom analyzers for your case
elasticsearch recently released suggester
for autocomplete, may be you will find this internal solution better http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
I'm using mongoid instead active record.
doesn't metter
from elasticsearch_autocomplete.
I have the same problem with completion suggester. I have tried in many ways. I have checked with this way:
Model user:
class User
include Mongoid::Document
field :city, :type => String
has_one: car
end
Model car:
class Car
include Mongoid::Document
ac_field :name, :user_city, :skip_settings => true
belongs_to: user
field: :name, :type => String
def ac_self.search(param)
tire.ac_search :load => true do
query do
boolean do
must { term :user_city, params[:user_city] } if params[:user_city].present?
end
end
filter :term, user_city: params[:user_city] if params[:user_city].present?
facet "cities" do
terms :user_city
end
end
def to_indexed_json
to_json(methods: [:user_city])
end
def user_city
user.city
end
end
This is my filter with facet user_city
<% @cars.facets['cities']['terms'].each do |facet| %>
<li>
<%= link_to_unless_current Car.find_or_initialize_by(city: facet['term']).city, params.merge(user_city: facet['term']) %>
<% if params[:car_city] == facet['term'].to_s %>
(<%= link_to "Remove", params.merge(car_city: nil) %>)
<% else %>
(<%= facet['count'] %>)
<% end %>
</li>
<% end %>
Once I'd made a search, I'd like to filter by the city of the vehicle owner.
If I add my own mapping, asciifolding filter
doesn't works. This is the main problem. How can I use asciifolding filter
with my own mapping.
Thanks!
from elasticsearch_autocomplete.
Ok I fixed the error with:
model = self
settings ElasticsearchAutocomplete::Analyzers::AC_BASE do
mapping _source: {enabled: true, includes: %w(car_city name)} do
indexes :car_city, :type => 'string', :index => :not_analyzed
end
end
Thanks!
from elasticsearch_autocomplete.
Related Issues (13)
- Strange Behaviour HOT 2
- merge old tire search class method with elasticsearch_autocomplete HOT 4
- How to add char_filter to the existing "ac_edge_ngram_full" analyser ? HOT 1
- is this working with Rails 4 and last version of Tire? HOT 1
- How to specify an alternative host/port? HOT 2
- Error Running Example | analyzer on field [ac_term] must be set when search_analyzer is set HOT 7
- Improvement Suggestion HOT 3
- Support for Mongoid HOT 4
- How to index more fields of the model? HOT 1
- Strange behavior for the index prefix HOT 1
- How can I provide the _source block to mapping? HOT 5
- Use this gem with mongoid instead of activerecord HOT 5
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 elasticsearch_autocomplete.