function that augments search results - #3472
Conversation
📊 Code Quality Score: 31/100
Was this score accurate? 👍 Yes · 👎 No Scored by GitVelocity · How are scores calculated? |
2ecdbad to
513a939
Compare
|
|
||
| # Public response controls. Clients may request fewer or more items, but values | ||
| # are clamped by the max constants to keep response size and query cost bounded. | ||
| _DEFAULT_RESULT_LIMIT = 10 |
There was a problem hiding this comment.
can all of these constants be class variables of the KnnSearch class? I realize _SEARCH_RESULT_FIELDS should also probably be moved there.
| return serialized | ||
|
|
||
| @staticmethod | ||
| def _linked_ref_text(ref): |
There was a problem hiding this comment.
this is just _ref_text. technically this function doesn't care about links
|
|
||
| class LinkSource(Protocol): | ||
| def linked_refs_for(self, ref: str) -> list[str]: | ||
| ... |
There was a problem hiding this comment.
actually, what are all these classes? maybe they're related to tests? can't we just have one normalize_ref function outside a class?
| if type(index_node).__name__ in {"DictionaryNode", "DictionaryEntryNode"}: | ||
| return True | ||
|
|
||
| index = getattr(oref, "index", None) |
There was a problem hiding this comment.
this whole second half of the function is nonsense. the categories it's checking don't even exist.
There was a problem hiding this comment.
the first part of the function is enough
| response.update({ | ||
| "linked_refs": [ | ||
| self._serialize_linked_ref(ref, include_text) | ||
| for ref in enhancement.appended_refs[:linked_ref_limit] |
There was a problem hiding this comment.
this arbitrarily cuts off linked ref enahncements. we should be retaining the ones with the highest link counts.
Description
A brief description of the PR
Code Changes
The following changes were made to the files below
Notes
Any additional notes go here