Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
guardrails: do case sensitive search (#53771)
Browse files Browse the repository at this point in the history
We want to do this since we are currently looking for exact matches.
Additionally attribution searches are slow on dotcom. My working theory
for why is related to how we lookup ngrams. By specifying case
sensitivity we drastically reduce the number of ngrams we need to check.

We also switch the protocol from Batch to Streaming. In practice this
makes no difference since we specify count. Using streaming is more
consistent with the other search clients.

Test Plan: go test
  • Loading branch information
keegancsmith authored and ErikaRS committed Jun 22, 2023
1 parent e49f8dc commit 3e10755
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ func (c *Service) snippetAttributionLocal(ctx context.Context, snippet string, l
const (
version = "V3"
searchMode = search.Precise
protocol = search.Batch
protocol = search.Streaming
)

patternType := "literal"
searchQuery := fmt.Sprintf("type:file select:repo index:only count:%d content:%q", limit, snippet)
searchQuery := fmt.Sprintf("type:file select:repo index:only case:yes count:%d content:%q", limit, snippet)

inputs, err := c.SearchClient.Plan(
ctx,
Expand Down

0 comments on commit 3e10755

Please sign in to comment.