Queries++ in RavenDBGimme more like this
What do you do when you find something you like? If this a favorite dish at a restaurant, you keep order it forever and ever. But if this is something like a good book or a TV show, you’ll typically want to check out similar stuff to enjoy as well. On a more serious note, if you are looking at a bug report, you might want to figure out if there has been other instances of the same issue or similar ones in the past, hopefully as you are typing the bug report.
The feature in general is called More Like This, and it is a nice way to smart up your application. I’m going to use this blog as the example, because More Like This usually requires a significant data set to be meaningful. We are going to define the following index:
And configure the index to use Term Vectors as part of the indexing process:
Once this initial configuration is done, you can now go to RavenDB and ask it to suggest similar posts to an existing one. Here is how this is done:
This ask RavenDB to find posts similar to: PR Review: Encapsulation stops at the assembly boundary, and the result is:
Note that you don’t have to specify an existing document, you can also send the values you want to match on directly:
And this will give you the same results.
More posts in "Queries++ in RavenDB" series:
- (18 Dec 2017) Spatial searches
- (15 Dec 2017) I suggest you can do better
- (11 Dec 2017) Gimme more like this
- (07 Dec 2017) Facets of information
Comments
Maybe works for bug reports, but in other areas not so much I dont want to buy another bicycle after I have just bought one, and certainly dont want to buy all the world's bicycles - and yet all online ads will magically turn into bicycles and stay this way for next month or so - until I buy shoes. Then it's shoes everywhere, and i'm getting anxiety attacks when opening the web browser.
Hey! I wrote the original plugin for this way back when (With lots of help from Oren!). Glad to see this functionality is getting its turn in the spot light! :)
Rafal, I'm just providing the features in this case. Using this for recommendations is pretty silly, exactly as you point out. You don't want the same thing, you want the next thing, in these cases.
Yep, i can't understand why the web ad campaigns try to sell you what you already have - maybe clear consequence of limited algorithms they have. Anyway, 'more like this' would be quite useful in call center / mass customer support systems for automatic classification of incoming problems - so instead of showing the user a list of similar problems, find a common class of similar cases and direct it to the correct department. And even without AI this thing would seem to 'learn' on past data.
If I like a certain book, say about cars, then the logic goes -- I will like similar products. Ad men actually advise their people to look for instances where customers bought similar products and target them. morelikethis() is a handy tool! There should literally be -- more like this!
Comment preview