mbarchfe

mbarchfe

Vector Search with JavaScript: couchbaseQuery is always the empty string (page 181)

Hi @hummusonrails,

I have created a capella account version 7.6.6.

I have started the server with current main branch.

When running the following query

 curl http://localhost:4000/api/search -X POST \
   -H "Content-Type: application/json" \
   -H "Accept: application/json" \
   -d '{"query":"your search text here"}'

then the couchbaseQuery text generated from build() returns an empty string.

Digging into it, the query is missing a queryType and therefore the build does not perform any building but returns the empty string.

Any idea why this happens?
Thanks
Markus

First Post!

hummusonrails

hummusonrails

Author of Vector Search with JavaScript

Hey there,

In the original flow in the sample application in the repo, /api/search was wired to the Ottoman query builder example, which generates SQL++ and not vector or full-text queries. Without a queryType, .build() just returns an empty string, that’s expected for that path.

I updated the repository example to be more straightforward going forward though. The updated flow now routes /api/search through the performSearch service. This is the part of the repo that uses the Couchbase SDK’s scope.search() API with a VectorSearch request, which is the intended way to run vector searches in this sample.

For it to return meaningful results, you’ll still need:

  • Documents in your Capella bucket/scope with an embedding array field
  • A Capella Vector Search index on that field

This sample is meant to illustrate how vector search fits into an app’s flow, not to be a complete production setup. If you want to take it further, the Couchbase docs walk through the full Capella + Node.js SDK setup:

With the current controller in place, once your index and embeddings are ready, /api/search will execute a proper vector search against Capella and return ranked results.

All the best,

Ben

Where Next?

Popular Pragmatic Bookshelf topics Top

brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New

Other popular topics Top

AstonJ
Or looking forward to? :nerd_face:
New
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
PragmaticBookshelf
Create efficient, elegant software tests in pytest, Python's most powerful testing framework. Brian Okken @brianokken Edited by Kat...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New

Sub Categories: