Skip to content

Commit ba7b886

Browse files
MrTangokobros-tech
authored andcommitted
[16.0][Add] connector_typesense: a connector to typsense search engine
1 parent 3c90caf commit ba7b886

30 files changed

Lines changed: 2540 additions & 0 deletions

connector_typesense/README.rst

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
===================
2+
connector_typesense
3+
===================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:f09633c3af59b153f0eba3f876a9835676c430a6f39dd0dfa3545a924c80bc11
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsearch--engine-lightgray.png?logo=github
20+
:target: https://github.com/OCA/search-engine/tree/16.0/connector_typesense
21+
:alt: OCA/search-engine
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/search-engine-16-0/search-engine-16-0-connector_typesense
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/search-engine&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This addon provides the bases to implement addons to export information to
32+
Typesense_ indexes.
33+
34+
.. _Typesense: https://typesense.org
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Installation
42+
============
43+
44+
This package requires a typesense search engine running.
45+
Please read this for a [quick docker based setup](https://typesense.org/docs/guide/install-typesense.html#option-2-local-machine-self-hosting).
46+
47+
Configuration
48+
=============
49+
50+
You have to configure (Host, Port, Protocol, Typesense API Key) in a new backend form view:
51+
52+
Search Engine > Configuration > Backends
53+
54+
Usage
55+
=====
56+
57+
a nice UI is also available here: https://github.com/bfritscher/typesense-dashboard/releases
58+
59+
60+
Bug Tracker
61+
===========
62+
63+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/search-engine/issues>`_.
64+
In case of trouble, please check there if your issue has already been reported.
65+
If you spotted it first, help us to smash it by providing a detailed and welcomed
66+
`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**>`_.
67+
68+
Do not contact contributors directly about support or help with technical issues.
69+
70+
Credits
71+
=======
72+
73+
Authors
74+
~~~~~~~
75+
76+
* Derico
77+
* Kencove
78+
79+
Contributors
80+
~~~~~~~~~~~~
81+
82+
* Sébastien BEAU <sebastien.beau@akretion.com>
83+
* Laurent Mignon <laurent.mignon@acsone.eu>
84+
* Simone Orsi <simone.orsi@camptocamp.com>
85+
* Raphaël Reverdy <raphael.reverdy@akretion.com>
86+
* Maik Derstappen <md@derico.de>
87+
* Mohamed Alkobrosli <malkobrosly@kencove.com>
88+
89+
Maintainers
90+
~~~~~~~~~~~
91+
92+
This module is maintained by the OCA.
93+
94+
.. image:: https://odoo-community.org/logo.png
95+
:alt: Odoo Community Association
96+
:target: https://odoo-community.org
97+
98+
OCA, or the Odoo Community Association, is a nonprofit organization whose
99+
mission is to support the collaborative development of Odoo features and
100+
promote its widespread use.
101+
102+
.. |maintainer-Kencove| image:: https://github.com/Kencove.png?size=40px
103+
:target: https://github.com/Kencove
104+
:alt: Kencove
105+
106+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
107+
108+
|maintainer-Kencove|
109+
110+
This module is part of the `OCA/search-engine <https://github.com/OCA/search-engine/tree/16.0/connector_typesense>`_ project on GitHub.
111+
112+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

connector_typesense/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from . import tools
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2024 Derico
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "connector_typesense",
6+
"category": "Connector",
7+
"summary": "Connector For Typesense Search Engine",
8+
"version": "16.0.0.0.2",
9+
"license": "AGPL-3",
10+
"author": "Derico, Kencove, Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/search-engine",
12+
"maintainers": ["Kencove"],
13+
"depends": ["connector_search_engine"],
14+
"data": [
15+
"views/ts_backend.xml",
16+
],
17+
"demo": ["demo/se_index_config_demo.xml", "demo/backend_demo.xml"],
18+
"external_dependencies": {"python": ["typesense==1.0.3", "requests"]},
19+
"installable": True,
20+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2019 ACSONE SA/NV
3+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4+
<odoo>
5+
<record id="backend_1" model="se.backend">
6+
<field name="name">Demo Sale Channel Typesense</field>
7+
<field name="tech_name">demo_sale_channel_typesense</field>
8+
<field name="backend_type">typesense</field>
9+
<field name="ts_server_host">localhost</field>
10+
<field name="ts_server_port">8108</field>
11+
<field name="ts_server_protocol">http</field>
12+
<field name="ts_api_key">xyz</field>
13+
</record>
14+
</odoo>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="se_index_config_product" model="se.index.config">
4+
<field name="name">TS Product Config</field>
5+
<field name="body">{}</field>
6+
<field name="body_str">
7+
{
8+
"name": "ts_products_collection",
9+
"fields": [
10+
{
11+
"name": "id",
12+
"type": "string"
13+
},
14+
{
15+
"name": "name",
16+
"type": "string"
17+
}
18+
]
19+
}
20+
</field>
21+
</record>
22+
</odoo>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import se_backend, se_index
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2024 Derico
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
from ..tools.adapter import TypesenseAdapter
7+
8+
9+
class SeBackend(models.Model):
10+
_inherit = "se.backend"
11+
12+
backend_type = fields.Selection(
13+
selection_add=[("typesense", "Typesense")],
14+
ondelete={"typesense": "cascade"},
15+
string="Type",
16+
required=True,
17+
)
18+
ts_server_host = fields.Char(
19+
string="Typesense host",
20+
groups="connector_search_engine.group_connector_search_engine_manager",
21+
)
22+
ts_server_port = fields.Char(
23+
string="Typesense port",
24+
groups="connector_search_engine.group_connector_search_engine_manager",
25+
)
26+
ts_server_protocol = fields.Char(
27+
string="Typesense protocol",
28+
groups="connector_search_engine.group_connector_search_engine_manager",
29+
)
30+
ts_server_timeout = fields.Integer(
31+
string="Typesense server timeout",
32+
groups="connector_search_engine.group_connector_search_engine_manager",
33+
)
34+
ts_api_key = fields.Char(
35+
help="Typesense Api Key",
36+
groups="connector_search_engine.group_connector_search_engine_manager",
37+
)
38+
39+
def _get_adapter_class(self):
40+
if self.backend_type == "typesense":
41+
return TypesenseAdapter
42+
else:
43+
return super()._get_adapter_class()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 Derico
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
from ..tools.serializer import TSJsonifySerializer
7+
8+
9+
class SeIndex(models.Model):
10+
11+
_inherit = "se.index"
12+
13+
serializer_type = fields.Selection(selection_add=[("typesense", "Typesense")])
14+
15+
def _get_serializer(self):
16+
if self.serializer_type == "typesense":
17+
return TSJsonifySerializer()
18+
else:
19+
return super()._get_serializer()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You have to configure (Host, Port, Protocol, Typesense API Key) in a new backend form view:
2+
3+
Search Engine > Configuration > Backends
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* Sébastien BEAU <sebastien.beau@akretion.com>
2+
* Laurent Mignon <laurent.mignon@acsone.eu>
3+
* Simone Orsi <simone.orsi@camptocamp.com>
4+
* Raphaël Reverdy <raphael.reverdy@akretion.com>
5+
* Maik Derstappen <md@derico.de>
6+
* Mohamed Alkobrosli <malkobrosly@kencove.com>

0 commit comments

Comments
 (0)