I'm using Solr 7.5.0.
I want to get boosted field and values per documents.

e.g.
documents:
  id: 1, features: [1]
  id: 2, features: [1,2]
  id: 3, features: [1,2,3]

query:
  bq: features:2^1.0 AND features:3^1.0

I expect results like below.
boosted:
  - id: 2
    - field: features, value: 2
  - id: 3
    - field: features, value: 2
    - field: features, value: 3

I have an idea that set boost score like bit-flag, but it's not good I
think because I must send query twice.

bit-flag:
  bq: features:2^2.0 AND features:3^4.0
  docs:
    - id: 1, score: 1.0(0x001)
    - id: 2, score: 3.0(0x011) # have feature:2(2nd bit is 1)
    - id: 3, score: 7.0(0x111) # have feature:2 and feature:3(2nd and 3rd
bit are 1)
check score value then I can get boosted field.

Is there a better way?

Reply via email to