Skip to content
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

Enable search data from SearchEngine component #3037

Merged

Conversation

frascuchon
Copy link
Member

@frascuchon frascuchon commented May 31, 2023

Description

Adding search functionality to the SearchEngine class. This functionality will be integrated with the new search endpoint in another PR.

This search applies a basic search over all record fields, or by selecting one of them.

Update

The search pagination will be tackled after the search endpoint integration.

Closes #3017

Type of change

(Please delete options that are not relevant. Remember to title the PR according to the type of change)

  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

New test cases have been added

Checklist

  • I have merged the original branch into my forked branch
  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@frascuchon frascuchon linked an issue May 31, 2023 that may be closed by this pull request
@frascuchon frascuchon marked this pull request as ready for review May 31, 2023 22:08
Copy link
Member

@gabrielmbmb gabrielmbmb left a comment

Choose a reason for hiding this comment

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

LGTM @frascuchon! Just two comments about creating some functions.

Comment on lines 169 to 175
text_query = {
"combined_fields": {
"query": query.text.q,
"fields": [f"fields.{field.name}" for field in dataset.fields],
"operator": "and",
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could move this to a function returning text_query as it would be easier to test with unit tests.

Comment on lines 178 to 185
text_query = {
"match_phrase": {
f"fields.{query.text.field}": {
"query": query.text.q,
"operator": "and",
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@gabrielmbmb
Copy link
Member

I'll check what is happening with the failing tests, it is related to the changes I introduced in #2993.

tests/server/test_search_engine.py Outdated Show resolved Hide resolved
* move text query build logic to a method
* Rename `TextFieldQuery` to `TextQuery`
@frascuchon frascuchon force-pushed the 3017-api-enable-search-data-from-searchengine-component branch from fcf6d1f to 391f217 Compare June 1, 2023 07:41
@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Patch coverage: 92.85% and project coverage change: +0.01 🎉

Comparison is base (888df08) 90.78% compared to head (1cbd04a) 90.80%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3037      +/-   ##
===========================================
+ Coverage    90.78%   90.80%   +0.01%     
===========================================
  Files          208      208              
  Lines        11113    11166      +53     
===========================================
+ Hits         10089    10139      +50     
- Misses        1024     1027       +3     
Flag Coverage Δ
pytest 90.80% <92.85%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/argilla/server/search_engine.py 93.91% <92.85%> (+0.26%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@frascuchon frascuchon merged commit ed95fc8 into develop Jun 1, 2023
@frascuchon frascuchon deleted the 3017-api-enable-search-data-from-searchengine-component branch June 1, 2023 09:40
davidberenstein1957 pushed a commit that referenced this pull request Jun 5, 2023
# Description

Adding `search` functionality to the `SearchEngine` class. This
functionality will be integrated with the new search endpoint in another
PR.

This search applies a basic search over all record fields, or by
selecting one of them.

### Update  

The search pagination will be tackled after the search endpoint
integration.

Closes #3017 

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [x] Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

New test cases have been added 

**Checklist**

- [x] I have merged the original branch into my forked branch
- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
davidberenstein1957 pushed a commit that referenced this pull request Jun 7, 2023
# Description

Adding `search` functionality to the `SearchEngine` class. This
functionality will be integrated with the new search endpoint in another
PR.

This search applies a basic search over all record fields, or by
selecting one of them.

### Update  

The search pagination will be tackled after the search endpoint
integration.

Closes #3017 

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [x] Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

New test cases have been added 

**Checklist**

- [x] I have merged the original branch into my forked branch
- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API] Enable search data from SearchEngine component
2 participants