(b byte)
| 138 | } |
| 139 | |
| 140 | func tsWeightFromVectorPGEncoding(b byte) (tsWeight, error) { |
| 141 | switch b { |
| 142 | case 3: |
| 143 | return weightA, nil |
| 144 | case 2: |
| 145 | return weightB, nil |
| 146 | case 1: |
| 147 | return weightC, nil |
| 148 | case 0: |
| 149 | // We don't explicitly return weightD, since it's the default. |
| 150 | return 0, nil |
| 151 | } |
| 152 | return 0, errors.Errorf("invalid encoded tsvector weight %d", b) |
| 153 | } |
| 154 | |
| 155 | // tsPosition is a position within a document, along with an optional weight. |
| 156 | type tsPosition struct { |
no test coverage detected
searching dependent graphs…