Skip to content

[16.0][ADD] field_vector_config - #90

Open
etobella wants to merge 4 commits into
OCA:16.0from
dixmit:16.0-add-field_vector_config
Open

[16.0][ADD] field_vector_config#90
etobella wants to merge 4 commits into
OCA:16.0from
dixmit:16.0-add-field_vector_config

Conversation

@etobella

@etobella etobella commented Jul 6, 2026

Copy link
Copy Markdown
Member

Also adds fastembed.

@OCA-git-bot OCA-git-bot added series:16.0 mod:field_vector_config Module field_vector_config labels Jul 6, 2026
Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/pre-commit.yml
Comment thread field_vector_config/tests/test_vector.py Outdated
query_str += " ORDER BY distance ASC"
if limit:
query_str += f" LIMIT {limit}"
self.env.cr.execute(query_str, params)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do not use SQL object here as well (mainly for the HAVING)?

Suggested change
self.env.cr.execute(query_str, params)
query = SQL(
"""
...
GROUP BY %s
""",
SQL.identifier(sql_terms[0]),
)
if minim:
query = SQL("%s HAVING %s < %s", query, SQL.identifier(distance), minim)
query = SQL("%s ORDER BY distance ASC", query)
if limit:
query = SQL("%s LIMIT %s", query, int(limit))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do something like this and I am unable to do it.

I will keep as it is for now.


@api.model
@api.returns("self")
def search_vector_grouped(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is not documented even reading test is's not chystal clear what that does and returns ! As far I understood it returns a record set of final_field (which must be a m2o field). The recordset is sorted by the shortest distance found for a final_field related field...

I suppose this allow a use case such "finding the best product.template while searching on product.product vector" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the idea.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose, some docstring or documentation in usage could be nice !

@etobella
etobella force-pushed the 16.0-add-field_vector_config branch from e91c2cd to 6e751db Compare September 4, 2026 04:12
@etobella
etobella force-pushed the 16.0-add-field_vector_config branch from 6e751db to 429d3cf Compare September 4, 2026 04:15
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

>>>>>>> after updating

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is another merge conflict here 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:field_vector_config Module field_vector_config series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants