51 Search API

Users can query stored documents using the search API to retrieve relevant results based on their input.
Endpoint
http request
POST /api/kb/<storeName>/search
Sample Request Payload
json
{
  "query":          "How can I implement PortableType in Coherence?",
  "maxResults":     10,
  "minScore":       0.7,
  "fullTextWeight": 0.5,
  "scoringModel":   "-/ms-marco-TinyBERT-L-2-v2"
}

The `scoringModel` and `minScore` attributes are optional. If the `scoringModel` is specified, it will be used to re-rank the results, and only the final, re-ranked results will be filtered based on the `minScore` value (if specified).

The `fullTextWeight` property is also optional, and allows you to specify how much weight to assign to full-text index search results when performing hybrid search. If not specified, hybrid search will be disabled and only vector search results will be returned.

Sample Response
json
{
  "results":        [
   {
     "chunkId": "https://docs.oracle.com/en/middleware/fusion-middleware/coherence/14.1.2/develop-applications/developing-applications-oracle-coherence.pdf#667",
     "index":   "VECTOR",
     "score":   0.9987151461996925,
     "text":    "• Implement serialization code at compile-time using byte code instrumentation, ..."
   },
   {
     "chunkId": "https://docs.oracle.com/en/middleware/fusion-middleware/coherence/14.1.2/develop-applications/developing-applications-oracle-coherence.pdf#665",
     "index":   "HYBRID",
     "score":   0.9937246879336528,
     "text":    "• It's versionable. Objects can evolve and have forward and backward compatibility.\n\n..."
   },
   {
     "chunkId": "https://docs.oracle.com/en/middleware/fusion-middleware/coherence/14.1.2/develop-remote-clients/developing-remote-clients-oracle-coherence.pdf#292",
     "index":   "FULL_TEXT",
     "score":   0.981980053233071,
     "text":    "This section includes the following topic:\n\n• Creating a PortableObject Implementation (Java)\n\nCreating a PortableObject Implementation (Java)..."
   },
   ...
   {
     "chunkId": "https://docs.oracle.com/en/middleware/fusion-middleware/coherence/14.1.2/develop-applications/developing-applications-oracle-coherence.pdf#668",
     "index":   "HYBRID",
     "score":   0.7846571128300767,
     "text":    "Understanding Usage Basics\nThere are only two basic requirements for Portable Types:\n\n• The class must be annotated with the @PortableType annotation\n\n• The fields that should be serialized must be annotated with @Portable or..."
   }
  ],
  "searchDuration": 11
}