I started to working on `querybean`, but I have few doubts.
1. Ordering by vector distance: ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
2. Selecting by distance (score): SELECT 1 - (embedding <=> '[3,1,2]') AS cosine_similarity
3. Limiting by distance (score): WHERE embedding <-> '[3,1,2]' < 5;
Ad. 3. This is the case that querybean would work, because it is in WHERE part.
But even for that I'm not sure, because this is a operator that returns a number, not boolean.
Ebean querybeans return boolean results mainly for filtering.
This issue is quite simple, because it can be resolved in two ways:
a) make 3/4 parameters querybean function, that takes other vector, operator and number ( WHERE embedding <-> param_1 _op_param_ _val_param_;) and this will be a valid filter,
b) make 1 parameter querybean function and return just another builder with float type; will it work with PFloat or I need to write another type?
Ad. 1. I'm not sure if this is possible with Ebean now?
But it seems like a b) scenario from above. I'm returning a PFloat (or new type) and there is method "desc"/"asc" and thats all.
Ad. 2. No clue about this one.
Nevertheless ORDER BY (point 1) and WHERE (point 2) will be good enought.
With vector stores we need to:
- order by vector discance (point 1),
- limit results amount (already works in Ebean),
- filter by attributes (normal/actual querybeans).
You support on this matter will be highly appreciated.