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

jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
mikecargal
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
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
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Get the comprehensive, insider information you need for Rails 8 with the new edition of this award-winning classic. Sam Ruby @rubys ...
New

Sub Categories: