CocoIndex and CocoInsight have added a Query mode. The result is directly linked and can be traced back step by step to how data is generated on the indexing path.CocoIndex and CocoInsight have added a Query mode. The result is directly linked and can be traced back step by step to how data is generated on the indexing path.

Developers Gain Direct Insight Into Data Flows With CocoIndex Update

We are launching a major feature in both CocoIndex and CocoInsight to help users fast iterate with the indexing strategy, and trace back all the way to the data — to make the transformation experience more seamlessly integrated with the end goal. With the new launch, you can define query handlers, so that you can easily run queries in tools like CocoInsight.

Checkout CocoIndex - https://github.com/cocoindex-io/cocoindex

CocoInsight

Does my data transformation creates meaningful index for retrieval?

In CocoInsight, we’ve added a Query mode. You can enable this by adding a CocoIndex Query Handler. You can quickly query index, and view the collected information for any entity.

Query mode

\ The result is directly linked and can be traced back step by step to how data is generated on the indexing path.

Where are the results coming from?

For example, this snippet comes from the file docs/docs/core/flow_def.mdx . The file was split into 30 chunks after transformation.

trace back data

Why is my chunk / snippet not showing in the search result?

When you perform a query, on the ranking path, you’d usually have a scoring mechanism. On the CocoInsight, you can quickly find any files you have in your mind, and for any chunks, you can scan the scoring in the same context.

Missing chunks

This gives you a powerful toolset with direct insight to end to end data transformation, to quickly iterate data indexing strategy without any headaches of building any additional UI or tools.

Integrate Query Logic with CocoIndex

Query Handler

To run queries in CocoInsight, you need to define query handlers. You can use any libraries or frameworks of your choice to perform queries.

You can read more in the documentation about Query Handler.

Query handlers let you expose a simple function that takes a query string and returns structured results. They are discoverable by tools like CocoInsight so you can query your indexes without building your own UI.

For example:

# Declaring it as a query handler, so that you can easily run queries in CocoInsight. @code_embedding_flow.query_handler(     result_fields=cocoindex.QueryHandlerResultFields(         embedding=["embedding"], score="score"     ) ) def search(query: str) -> cocoindex.QueryOutput:     # Get the table name, for the export target in the code_embedding_flow above.     table_name = cocoindex.utils.get_target_default_name(         code_embedding_flow, "code_embeddings"     )     # Evaluate the transform flow defined below with the input query, to get the embedding.     query_vector = code_to_embedding.eval(query)     # Run the query and get the results.     with connection_pool().connection() as conn:         register_vector(conn)         with conn.cursor() as cur:             cur.execute(                 f"""                 SELECT filename, code, embedding, embedding <=> %s AS distance, start, "end"                 FROM {table_name} ORDER BY distance LIMIT %s             """,                 (query_vector, TOP_K),             )             return cocoindex.QueryOutput(                 query_info=cocoindex.QueryInfo(                     embedding=query_vector,                     similarity_metric=cocoindex.VectorSimilarityMetric.COSINE_SIMILARITY,                 ),                 results=[                     {                         "filename": row[0],                         "code": row[1],                         "embedding": row[2],                         "score": 1.0 - row[3],                         "start": row[4],                         "end": row[5],                     }                     for row in cur.fetchall()                 ],             ) 

This code defines a query handler that:

  1. Turns the input query into an embedding vector. code_to_embedding is a shared transformation flow between Query and Index path, see detailed explanation below.
  2. Searches a database of code embeddings using cosine similarity.
  3. Returns the top matching code snippets with their filename, code, embedding, score, and positions.

Sharing Logic Between Indexing and Query

Sometimes, transformation logic needs to be shared between indexing and querying, e.g. when we build a vector index and query against it, the embedding computation needs to be consistent between indexing and querying.

You can find the documentation about Transformation Flow.

You can use @cocoindex.transform_flow() to define shared logic. For example

@cocoindex.transform_flow() def text_to_embedding(text: cocoindex.DataSlice[str]) -> cocoindex.DataSlice[NDArray[np.float32]]:     return text.transform(         cocoindex.functions.SentenceTransformerEmbed(             model="sentence-transformers/all-MiniLM-L6-v2")) 

In your indexing flow, you can directly call it

with doc["chunks"].row() as chunk:     chunk["embedding"] = text_to_embedding(chunk["text"]) 

In your query logic, you can call the eval() method with a specific value

def search(query: str) -> cocoindex.QueryOutput:     # Evaluate the transform flow defined below with the input query, to get the embedding.     query_vector = code_to_embedding.eval(query) 

Examples

  • Text Embedding (PostgreSQL)
  • Text Embedding (Qdrant)
  • Code Embedding

Beyond Vector Index

We use vector index in this blog. CocoIndex is a powerful data transformation framework that is beyond vector index. You can use it to build vector index, knowledge graph, structured extraction and transformation and any custom logic towards your need on efficient retrieval from fresh data.

Support Us

We’re constantly adding more examples and improving our runtime. ⭐ Star CocoIndex on GitHub and share the love ❤️ !

And let us know what are you building with CocoIndex — we’d love to feature them.

Market Opportunity
Griffin AI Logo
Griffin AI Price(GAIN)
$0.003
$0.003$0.003
-0.72%
USD
Griffin AI (GAIN) Live Price Chart
Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact [email protected] for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

Q4 2025 May Have Marked the End of the Crypto Bear Market: Bitwise

Q4 2025 May Have Marked the End of the Crypto Bear Market: Bitwise

The fourth quarter of 2025 may have quietly signaled the end of the crypto bear market, according to a new report from digital asset manager Bitwise, even as prices
Share
CryptoNews2026/01/22 15:06
CEO Sandeep Nailwal Shared Highlights About RWA on Polygon

CEO Sandeep Nailwal Shared Highlights About RWA on Polygon

The post CEO Sandeep Nailwal Shared Highlights About RWA on Polygon appeared on BitcoinEthereumNews.com. Polygon CEO Sandeep Nailwal highlighted Polygon’s lead in global bonds, Spiko US T-Bill, and Spiko Euro T-Bill. Polygon published an X post to share that its roadmap to GigaGas was still scaling. Sentiments around POL price were last seen to be bearish. Polygon CEO Sandeep Nailwal shared key pointers from the Dune and RWA.xyz report. These pertain to highlights about RWA on Polygon. Simultaneously, Polygon underlined its roadmap towards GigaGas. Sentiments around POL price were last seen fumbling under bearish emotions. Polygon CEO Sandeep Nailwal on Polygon RWA CEO Sandeep Nailwal highlighted three key points from the Dune and RWA.xyz report. The Chief Executive of Polygon maintained that Polygon PoS was hosting RWA TVL worth $1.13 billion across 269 assets plus 2,900 holders. Nailwal confirmed from the report that RWA was happening on Polygon. The Dune and https://t.co/W6WSFlHoQF report on RWA is out and it shows that RWA is happening on Polygon. Here are a few highlights: – Leading in Global Bonds: Polygon holds 62% share of tokenized global bonds (driven by Spiko’s euro MMF and Cashlink euro issues) – Spiko U.S.… — Sandeep | CEO, Polygon Foundation (※,※) (@sandeepnailwal) September 17, 2025 The X post published by Polygon CEO Sandeep Nailwal underlined that the ecosystem was leading in global bonds by holding a 62% share of tokenized global bonds. He further highlighted that Polygon was leading with Spiko US T-Bill at approximately 29% share of TVL along with Ethereum, adding that the ecosystem had more than 50% share in the number of holders. Finally, Sandeep highlighted from the report that there was a strong adoption for Spiko Euro T-Bill with 38% share of TVL. He added that 68% of returns were on Polygon across all the chains. Polygon Roadmap to GigaGas In a different update from Polygon, the community…
Share
BitcoinEthereumNews2025/09/18 01:10
BlackRock Increases U.S. Stock Exposure Amid AI Surge

BlackRock Increases U.S. Stock Exposure Amid AI Surge

The post BlackRock Increases U.S. Stock Exposure Amid AI Surge appeared on BitcoinEthereumNews.com. Key Points: BlackRock significantly increased U.S. stock exposure. AI sector driven gains boost S&P 500 to historic highs. Shift may set a precedent for other major asset managers. BlackRock, the largest asset manager, significantly increased U.S. stock and AI sector exposure, adjusting its $185 billion investment portfolios, according to a recent investment outlook report.. This strategic shift signals strong confidence in U.S. market growth, driven by AI and anticipated Federal Reserve moves, influencing significant fund flows into BlackRock’s ETFs. The reallocation increases U.S. stocks by 2% while reducing holdings in international developed markets. BlackRock’s move reflects confidence in the U.S. stock market’s trajectory, driven by robust earnings and the anticipation of Federal Reserve rate cuts. As a result, billions of dollars have flowed into BlackRock’s ETFs following the portfolio adjustment. “Our increased allocation to U.S. stocks, particularly in the AI sector, is a testament to our confidence in the growth potential of these technologies.” — Larry Fink, CEO, BlackRock The financial markets have responded favorably to this adjustment. The S&P 500 Index recently reached a historic high this year, supported by AI-driven investment enthusiasm. BlackRock’s decision aligns with widespread market speculation on the Federal Reserve’s next moves, further amplifying investor interest and confidence. AI Surge Propels S&P 500 to Historic Highs At no other time in history has the S&P 500 seen such dramatic gains driven by a single sector as the recent surge spurred by AI investments in 2023. Experts suggest that the strategic increase in U.S. stock exposure by BlackRock may set a precedent for other major asset managers. Historically, shifts of this magnitude have influenced broader market behaviors as others follow suit. Market analysts point to the favorable economic environment and technological advancements that are propelling the AI sector’s momentum. The continued growth of AI technologies is…
Share
BitcoinEthereumNews2025/09/18 02:49