查询
{"query":{"query_string":{"query":"name:pi*"}}}
Out put
hits: [
{
_score: 1
_source: {
handle: PIXIES
name: Pixies
}
}
{
_score: 1
_source: {
handle: twentyonepilots
name: twenty one pilots
}
}
{
_score: 1
_source: {
handle: Antonio_Pinto
name: Antonio Pinto
}
}
{
_score: 1
_source: {
handle: null
name: Piano Tribute Players
}
}
{
_score: 1
_source: {
handle: null
name: Los Pinguos
}
}
{
_score: 1
_source: {
handle: null
name: Piyush Mishra & Bhupesh Singh
}
}
{
_score: 1
_source: {
handle: pinkfloyd
name: Pink Floyd
}
}]
如果您查看结果,它会将名称中的术语与pi *匹配,这是我对上述查询的期望。
但是如何编写查询以在字段中使用术语位置(位置索引)对结果进行排序。
该查询的结果应该会在列表顶部弹出Piano Tribute Players
,Pink Floyd
。因为他们以pi *
关于solr的类似问题:SOLR: Boosting based on location of search term in field