Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Conversation

@calyptobai
Copy link
Contributor

No description provided.

@ggordonhall ggordonhall requested a review from oppiliappan June 30, 2023 08:01
query: Box<dyn tantivy::query::Query>,
searcher: tantivy::Searcher,
) -> Result<ContentDocument> {
) -> Result<Option<ContentDocument>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we could structure the return type a bit better in a future PR; top_hit (and its descendant functions file_body and by_path) can:

  • return 0 docs if there are no results
  • exactly 1 doc
  • more than 1 doc if there are duplicates in the index

in this PR it is modeled as:

  • Ok(None): zero results
  • Ok(Some(_)): one result
  • Err(_): many results

but this might be nicer if we use error enum variants for each scenario.

@ggordonhall ggordonhall merged commit a39011a into main Jun 30, 2023
@ggordonhall ggordonhall deleted the path-hallucination-panic branch June 30, 2023 16:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants