-
-
Notifications
You must be signed in to change notification settings - Fork 65
[16.0][ADD] Connector typesense #203
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| =================== | ||
| connector_typesense | ||
| =================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:f09633c3af59b153f0eba3f876a9835676c430a6f39dd0dfa3545a924c80bc11 | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsearch--engine-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/search-engine/tree/16.0/connector_typesense | ||
| :alt: OCA/search-engine | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/search-engine-16-0/search-engine-16-0-connector_typesense | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
| :target: https://runboat.odoo-community.org/builds?repo=OCA/search-engine&target_branch=16.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This addon provides the bases to implement addons to export information to | ||
| Typesense_ indexes. | ||
|
|
||
| .. _Typesense: https://typesense.org | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Installation | ||
| ============ | ||
|
|
||
| This package requires a typesense search engine running. | ||
| Please read this for a [quick docker based setup](https://typesense.org/docs/guide/install-typesense.html#option-2-local-machine-self-hosting). | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| You have to configure (Host, Port, Protocol, Typesense API Key) in a new backend form view: | ||
|
|
||
| Search Engine > Configuration > Backends | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| a nice UI is also available here: https://github.com/bfritscher/typesense-dashboard/releases | ||
|
|
||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/search-engine/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/search-engine/issues/new?body=module:%20connector_typesense%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ~~~~~~~ | ||
|
|
||
| * Derico | ||
| * Kencove | ||
|
|
||
| Contributors | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * Maik Derstappen <md@derico.de> | ||
| * Mohamed Alkobrosli <malkobrosly@kencove.com> | ||
|
|
||
| Maintainers | ||
| ~~~~~~~~~~~ | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| .. |maintainer-Kencove| image:: https://github.com/Kencove.png?size=40px | ||
| :target: https://github.com/Kencove | ||
| :alt: Kencove | ||
|
|
||
| Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
|
||
| |maintainer-Kencove| | ||
|
|
||
| This module is part of the `OCA/search-engine <https://github.com/OCA/search-engine/tree/16.0/connector_typesense>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import models | ||
| from . import tools |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright 2024 Derico | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "connector_typesense", | ||
| "category": "Connector", | ||
| "summary": "Connector For Typesense Search Engine", | ||
| "version": "16.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "author": "Derico, Kencove, Odoo Community Association (OCA)", | ||
| "website": "https://github.com/OCA/search-engine", | ||
| "maintainers": ["Kencove"], | ||
| "depends": ["connector_search_engine"], | ||
| "data": [ | ||
| "views/ts_backend.xml", | ||
| ], | ||
| "demo": ["demo/se_index_config_demo.xml", "demo/backend_demo.xml"], | ||
| "external_dependencies": {"python": ["typesense==1.0.3", "requests"]}, | ||
| "installable": True, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright 2025 Kencove | ||
| License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
| <odoo> | ||
| <record id="backend_1" model="se.backend"> | ||
| <field name="name">Demo Sale Channel Typesense</field> | ||
| <field name="tech_name">demo_sale_channel_typesense</field> | ||
| <field name="backend_type">typesense</field> | ||
| <field name="ts_server_host">localhost</field> | ||
| <field name="ts_server_port">8108</field> | ||
| <field name="ts_server_protocol">http</field> | ||
| <field name="ts_api_key">xyz</field> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <odoo> | ||
| <record id="se_index_config_product" model="se.index.config"> | ||
| <field name="name">TS Product Config</field> | ||
| <field name="body">{}</field> | ||
| <field name="body_str"> | ||
| { | ||
| "name": "ts_products_collection", | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "type": "string" | ||
| }, | ||
| { | ||
| "name": "name", | ||
| "type": "string" | ||
| } | ||
| ] | ||
| } | ||
| </field> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import se_backend, se_index |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright 2024 Derico | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
| from ..tools.adapter import TypesenseAdapter | ||
|
|
||
|
|
||
| class SeBackend(models.Model): | ||
| _inherit = "se.backend" | ||
|
|
||
| backend_type = fields.Selection( | ||
| selection_add=[("typesense", "Typesense")], | ||
| ondelete={"typesense": "cascade"}, | ||
| string="Type", | ||
| required=True, | ||
| ) | ||
| ts_server_host = fields.Char( | ||
| string="Typesense host", | ||
| groups="connector_search_engine.group_connector_search_engine_manager", | ||
| ) | ||
| ts_server_port = fields.Char( | ||
| string="Typesense port", | ||
| groups="connector_search_engine.group_connector_search_engine_manager", | ||
| ) | ||
| ts_server_protocol = fields.Char( | ||
| string="Typesense protocol", | ||
| groups="connector_search_engine.group_connector_search_engine_manager", | ||
| ) | ||
| ts_server_timeout = fields.Integer( | ||
| string="Typesense server timeout", | ||
| groups="connector_search_engine.group_connector_search_engine_manager", | ||
| ) | ||
| ts_api_key = fields.Char( | ||
| help="Typesense Api Key", | ||
| groups="connector_search_engine.group_connector_search_engine_manager", | ||
| ) | ||
|
|
||
| def _get_adapter_class(self): | ||
| if self.backend_type == "typesense": | ||
| return TypesenseAdapter | ||
| else: | ||
| return super()._get_adapter_class() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2024 Derico | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
| from ..tools.serializer import TSJsonifySerializer | ||
|
|
||
|
|
||
| class SeIndex(models.Model): | ||
|
|
||
| _inherit = "se.index" | ||
|
|
||
| serializer_type = fields.Selection(selection_add=[("typesense", "Typesense")]) | ||
|
|
||
| def _get_serializer(self): | ||
| if self.serializer_type == "typesense": | ||
| return TSJsonifySerializer() | ||
| else: | ||
| return super()._get_serializer() | ||
|
Comment on lines
+13
to
+19
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It do not make sense to add a serializer here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shopinvader is doing the same by the way in its custom modules but I am not following shopinvader as it looks old technique and hard code serialzing but I do dynamic serialzing.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it will better to add a "dynamic serialer" in a separated module, because the serializer is not related to typesense (it can be used for other search engine
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There are no old and new or right and wrong approaches. It all depends on individual needs and sensitivities. With this in mind, the architecture of these modules has been designed to allow easy adaptation to individual needs.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sorry, I can't compare one single module to a project :) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| You have to configure (Host, Port, Protocol, Typesense API Key) in a new backend form view: | ||
|
|
||
| Search Engine > Configuration > Backends |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| * Maik Derstappen <md@derico.de> | ||
| * Mohamed Alkobrosli <malkobrosly@kencove.com> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| This addon provides the bases to implement addons to export information to | ||
| Typesense_ indexes. | ||
|
|
||
| .. _Typesense: https://typesense.org |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| This package requires a typesense search engine running. | ||
| Please read this for a [quick docker based setup](https://typesense.org/docs/guide/install-typesense.html#option-2-local-machine-self-hosting). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| a nice UI is also available here: https://github.com/bfritscher/typesense-dashboard/releases | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.