Skip to content

Commit 5a0cb48

Browse files
committed
[16.0][ADD] typesense_ir_exports
1 parent 3c90caf commit 5a0cb48

18 files changed

Lines changed: 830 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../typesense_ir_exports
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

typesense_ir_exports/README.rst

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
==============================
2+
Typesense Serializer Ir Export
3+
==============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:e34acef6723d2b511d4c8bc7121cb9d33741e025400c7f3af527c5a95a10ebaa
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
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/typesense_ir_exports
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-typesense_ir_exports
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+
Use Exporter (ir.exports) as serializer for connector_typesense
32+
33+
Each ir.exports records is converted into JSON and JSON data get indexed into the Search Engine.
34+
35+
Data can be String, Integer, Float, Lists, and Relations in the form of Object.
36+
37+
Thnaks to the dynamic Schema configuration we can add new fields or remove without breaking the Schema.
38+
39+
Binary data like images are sent as string, but better if we use external filestore to use images related external urls.
40+
41+
.. IMPORTANT::
42+
This is an alpha version, the data model and design can change at any time without warning.
43+
Only for development or testing purpose, do not use in production.
44+
`More details on development status <https://odoo-community.org/page/development-status>`_
45+
46+
**Table of contents**
47+
48+
.. contents::
49+
:local:
50+
51+
Bug Tracker
52+
===========
53+
54+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/search-engine/issues>`_.
55+
In case of trouble, please check there if your issue has already been reported.
56+
If you spotted it first, help us to smash it by providing a detailed and welcomed
57+
`feedback <https://github.com/OCA/search-engine/issues/new?body=module:%20typesense_ir_exports%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
58+
59+
Do not contact contributors directly about support or help with technical issues.
60+
61+
Credits
62+
=======
63+
64+
Authors
65+
~~~~~~~
66+
67+
* Kencove
68+
69+
Contributors
70+
~~~~~~~~~~~~
71+
72+
* Mohamed Alkobrosli <malkobrosly@kencove.com>
73+
74+
Maintainers
75+
~~~~~~~~~~~
76+
77+
This module is maintained by the OCA.
78+
79+
.. image:: https://odoo-community.org/logo.png
80+
:alt: Odoo Community Association
81+
:target: https://odoo-community.org
82+
83+
OCA, or the Odoo Community Association, is a nonprofit organization whose
84+
mission is to support the collaborative development of Odoo features and
85+
promote its widespread use.
86+
87+
.. |maintainer-Kencove| image:: https://github.com/Kencove.png?size=40px
88+
:target: https://github.com/Kencove
89+
:alt: Kencove
90+
91+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
92+
93+
|maintainer-Kencove|
94+
95+
This module is part of the `OCA/search-engine <https://github.com/OCA/search-engine/tree/16.0/typesense_ir_exports>`_ project on GitHub.
96+
97+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

typesense_ir_exports/__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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2023 Kencove (https://kencove.com).
2+
# @author Mohamed Alkobrosli <malkobrosly@kencove.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Typesense Serializer Ir Export",
7+
"summary": "Use Exporter (ir.exports) as serializer for index",
8+
"version": "16.0.1.0.0",
9+
"category": "Uncategorized",
10+
"website": "https://github.com/OCA/search-engine",
11+
"author": "Kencove, Odoo Community Association (OCA)",
12+
"maintainers": ["Kencove"],
13+
"license": "AGPL-3",
14+
"development_status": "Alpha",
15+
"depends": [
16+
"connector_search_engine_serializer_ir_export",
17+
],
18+
"data": [
19+
"data/se_index_config_data.xml",
20+
"views/se_index_view.xml",
21+
],
22+
"installable": True,
23+
"assets": {
24+
"web.assets_backend": [
25+
"typesense_ir_exports/static/src/action_ir_export.xml",
26+
"typesense_ir_exports/static/src/action_ir_export.esm.js",
27+
],
28+
},
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo noupdate="1">
3+
<record id="se_index_config_product" model="se.index.config">
4+
<field name="name">TS Product Dynamic Fields 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+
"name": ".*",
20+
"type": "auto",
21+
"optional": true
22+
}
23+
],
24+
"enable_nested_fields": true
25+
}
26+
</field>
27+
</record>
28+
</odoo>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import se_index
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 Kencove (https://kencove.com).
2+
# @author Mohamed Alkobrosli <malkobrosly@kencove.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
from odoo import models
6+
7+
from ..tools.serializer import JsonifySerializer
8+
9+
10+
class SeIndex(models.Model):
11+
_inherit = "se.index"
12+
13+
def _get_serializer(self):
14+
if (
15+
self.serializer_type == "ir_exports"
16+
and self.backend_id.backend_type == "typesense"
17+
):
18+
parser = self.exporter_id.get_json_parser()
19+
return JsonifySerializer(parser=parser, index=self)
20+
else:
21+
return super()._get_serializer()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Mohamed Alkobrosli <malkobrosly@kencove.com>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Use Exporter (ir.exports) as serializer for connector_typesense
2+
3+
Each ir.exports records is converted into JSON and JSON data get indexed into the Search Engine.
4+
5+
Data can be String, Integer, Float, Lists, and Relations in the form of Object.
6+
7+
Thnaks to the dynamic Schema configuration we can add new fields or remove without breaking the Schema.
8+
9+
Binary data like images are sent as string, but better if we use external filestore to use images related external urls.

0 commit comments

Comments
 (0)