Comments (6)
This could probably be modelled by simply having follows
as it's own document type with the fields: followee
, follower
and position
. Then you can:
SELECT * FROM follows
WHERE followee = "BigBob"
ORDER BY position;
from vespa.
@lesters do you mean, follows
should be a struct data type with {followee
, follower
, and position
} fields? I'm not sure I follow how that would work, considering array can't be indexed. Also, in your pseudo sql example above -- am I expecting to get back a list of profile IDs, or the actual profiles?
from vespa.
Yes, not much you can do with structs in Vespa other than storing and retrieving them.
You either need to do as Lester suggests, which gives you a lot of power at the expense of a higher document count, or
To retrieve all followers:
Add a new field followsHandle of type array which you can index and search.
To sort by follow time of the matching follower, you can either
Retrieve it from the "follows" array of struct in Java Searcher plugin (or in the client. This will be slow if you have a high number of followers.
or,
Add a
field handletimes type tensor(handle{})
to the document, where the value of each element is the add time, and pass a tensor(handle{}) in the query (say, query(follower)) with a single element {{handle:BigBob}:1}, and then rank by the ranking expression
sum(query(handles)*attribute(handletimes))
(i.e take the dot product).
This will work fine, but if the above is your one main use case it may be a bit complicated.
from vespa.
To elaborate on what I meant, by having follows
as it's own document type, each edge in your social graph would be represented by a document. This allows some flexibility in maintaining the graph as well as the types of queries you can run (e.g. "who am I following" and "who is following me"). You could also attach additional information to the relationship if you needed that. Queries would return user id's. If you needed actual profile information you could retrieve that in a secondary query in a searcher (kind of like a fill
) before returning to the user.
The downside is as Jon mentions a higher document count.
I guess this depends on the type of queries you would like to run?
from vespa.
Thanks for the pointers, guys.
Sounds like the best approach is in-fact a multiphase searcher. As I understand it, the searcher lives in the container cluster, and runs once (as opposed to living container, and running once for each bucket). I'm slightly worried about the memory footprint a searcher might need for a "supernode" query (e.g. a BarackObama type account with 50M followers). We'll try out various methods and report back to this thread later.
from vespa.
@schonfeld Still, if in 1 document, the BarackObama document will be huge!?
So you want to search only inside "follows" or you also want to search the top document "handle=Barack" ?
from vespa.
Related Issues (20)
- Vespa visit not returning deleted documents when selection criteria is added. HOT 3
- [Schema streaming mode] Enhence rank calculation for substring search HOT 5
- Make behaviour between `global` and `second` phase when `ranking.sorting=''` is given consistent HOT 1
- Allow multiple tensor outputs from native Vespa embedders HOT 3
- Pyvespa deployment fails HOT 5
- [Schema streaming mode] bm25 score is always zero HOT 2
- Array length as search criteria HOT 1
- Sorry couldn't find a discussion tab, so asking here. Can vespa be used as a primary database? HOT 3
- Evaluate onnx models with onnxruntime HOT 3
- Export Vespa golang client API as a library HOT 5
- Parse exception for regular expression HOT 2
- Make YQL Query Syntax Parse Exception more meaningful
- Case sensitive search not supported on index fields HOT 2
- special-tokens not applied for document, only query HOT 1
- Add a topk tensor function for mapped tensors
- Indexing language fails on an empty array HOT 2
- Reindexing is getting stalled
- Inconsistent rendering of string versus array of string with regards to unicode escaping HOT 2
- Vespa 9: Consider updating bm25 hyperparameter defaults
- Segmented And behaviour with weakAnd for CJK languages HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vespa.