Searchkick 发送许多查询
Searchkick send many queries
我对 Searchkick 有疑问。
当我发送这样的查询时
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name]
)
Searchkick 发送包含许多此类查询的请求
http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search"}}},{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search2"}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search2","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
但是当我将查询更改为
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
match: :word_start
)
Searchkick 只发送两个查询的请求
curl http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.word_start":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_word_search"}}},{"match":{"name.word_start":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_word_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
'searchkick', '1.3.5'
'rails', '4.1.5'
elasticsearch 1.7.4
如何解决这个问题并只发送一个查询?
需要将 misspellings: false
添加到这样的搜索方法中
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
misspellings: false,
match: :word_start
)
我对 Searchkick 有疑问。 当我发送这样的查询时
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name]
)
Searchkick 发送包含许多此类查询的请求
http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search"}}},{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search2"}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search2","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
但是当我将查询更改为
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
match: :word_start
)
Searchkick 只发送两个查询的请求
curl http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.word_start":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_word_search"}}},{"match":{"name.word_start":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_word_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
'searchkick', '1.3.5'
'rails', '4.1.5'
elasticsearch 1.7.4
如何解决这个问题并只发送一个查询?
需要将 misspellings: false
添加到这样的搜索方法中
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
misspellings: false,
match: :word_start
)