-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add searx.results module #1562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add searx.results module #1562
Conversation
|
In documentation, sphinx.ext.inheritance_diagram could be helpful to draw the inheritance diagram. |
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
|
@dalf FYI I picked up this PR and continue to develop in (my) branch https://github.com/return42/searxng/commits/refactor_results .. its fare from usable .. I will ping you when I have something I can show you. |
UPDATE: Since Type-Hints are not classes (can't be instantiated) I prefer common classes that inherit from a dict-Type. I mean: if we implement type-hints we can only check types (and add some doc-strings) but we can't implement methods like we know from OO paradigm .. TBH: IMO these "typing" stuff is sometimes an overkill. Python is a language with dynamic types and type-hints can help to valid some types in static checks but I also think it should used sparse and with care. –--- |
|
The idea of this PR is to make a clear list of the result types and theirs fields (models.py) without changing anything about the implementation. Actually it is the documentation you wrote but converted as Python typing.
I'm sure if you talk about TypedDict or typing in general.
But talking about OO classes and instances: https://gist.github.com/dalf/972eb05e7a9bee161487132a7de244d2 . There is
|
Yes, I was talking about TypedDict 👎 .. to me, type-hints in function's prototype are very useful 👍 👍 TBH I don't really know what the use-case for e.g. TypeDict is .. when we use
I don't have a final meaning about / I will ignore the URL class for now (we can have a look at this later), I like to finish the class model of the result types first ..
LGTM but I will also ignore for now .. like URL this is a bit OT from my POV (class model of result)
I don't prefer this approach; for me an engine is something like a plugin that returns a simple data type (a python dict or list). I don't want to bind the return value of the engine to a special data-type that is used (internally) in SearXNG. I prefer to stay with the current concept, where SearXNG determines the result type by the existence of a property. The coupling of engine and server code should be as simple as possible ... then it might be possible to add a layer at this point in the architecture to send a request to a remote SearXNG node for example (just dreaming a bit). I really like the Remarks about the gist: In the gist you implemented a method EngineResult.merge .. I have a doubt if the merge is a task of the |
be52ff8 to
357fab5
Compare
051ba92 to
5667064
Compare
Based on searxng#1412
5667064 to
31dc8dc
Compare
31dc8dc to
7a43a81
Compare
What does this PR do?
Based on #1412
Add Python types about the results.
The purpose is described the fields with code using TypedDict.
Why is this change important?
Add documentation about the different result types.
How to test this PR locally?
Author's checklist
pyright errors have been fixed.
Related issues
Related to #1412