在Redisearch中搜索时,我们可以指定不同的字段权重吗?

huangapple go评论97阅读模式
英文:

can we specify different field weights while searching in redisearch?

问题

When we create an index on redisearch, we specify different fields with their weights e.g. title text weight 50 description text weight 25 and as per my understanding these weights determine the ordering of results.

I want to know is there a way to specify fields weights which searching i.e. using FT.SEARCH

I would like to change field weights on runtime i.e. according to the query.

I would like to accomplish something like this

FT.SEARCH idx john description weight 50 title weight 25

See how I have tried to change weights while querying.

英文:

When we create an index on redisearch, we specify different fields with their weights e.g. title text weight 50 description text weight 25 and as per my understanding these weights determine the ordering of results.

I want to know is there a way to specify fields weights which searching i.e. using FT.SEARCH

I would like to change field weights on runtime i.e. according to the query.

I would like to accomplish something like this

FT.SEARCH idx john description weight 50 title weight 25

See how I have tried to change weights while querying.

答案1

得分: 3

你可以使用"query attribute"来指定查询的不同部分的权重。更多详情请参考这里:https://oss.redislabs.com/redisearch/Query_Syntax.html#query_attributes

英文:

You can use query attribute to specify different weight for different parts of the query. Take a look here for more details: https://oss.redislabs.com/redisearch/Query_Syntax.html#query_attributes

huangapple
  • 本文由 发表于 2020年1月3日 23:32:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/59581249.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定