pickFactoryCreateSpec(ctx, attr) will find the FactoryCreateSpec (i.e., index name + options) for the given attribute "attr". Note that unlike pickTokenizer(ctx, attr, f), we do not include the parameter "f" (for function name), as we do not take action with it. This is otherwise similar to pickToke
(ctx context.Context, attr string)
| 126 | // parameter "f" (for function name), as we do not take action with it. |
| 127 | // This is otherwise similar to pickTokenizer. |
| 128 | func pickFactoryCreateSpec(ctx context.Context, attr string) (*tok.FactoryCreateSpec, error) { |
| 129 | // Get the tokenizers and choose the corresponding one. |
| 130 | if !schema.State().IsIndexed(ctx, attr) { |
| 131 | return nil, errors.Errorf("Attribute %s is not indexed.", attr) |
| 132 | } |
| 133 | |
| 134 | cspecs, err := schema.State().FactoryCreateSpec(ctx, attr) |
| 135 | if err != nil { |
| 136 | return nil, err |
| 137 | } |
| 138 | if len(cspecs) == 0 { |
| 139 | return nil, errors.Errorf("Schema state not found for %s.", attr) |
| 140 | } |
| 141 | |
| 142 | // At the moment, it would only be relevant to consider the first one. |
| 143 | // This is similar to pickTokenizer in behavior. |
| 144 | return cspecs[0], nil |
| 145 | } |
| 146 | |
| 147 | // getInequalityTokens gets tokens ge/le/between compared to given tokens using the first sortable |
| 148 | // index that is found for the predicate. |
no test coverage detected