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
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New

Other popular topics Top

AstonJ
Or looking forward to? :nerd_face:
483 11078 254
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
PragmaticBookshelf
Programming Ruby is the most complete book on Ruby, covering both the language itself and the standard library as well as commonly used t...
New
hilfordjames
There appears to have been an update that has changed the terminology for what has previously been known as the Taskbar Overflow - this h...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Sub Categories: