Skip to content

Enhance search and ordering fields across remaining REST API endpoints - #12737

Open
bhumin18 wants to merge 14 commits into
inventree:masterfrom
bhumin18:enhance-remaining-api-search-fields
Open

Enhance search and ordering fields across remaining REST API endpoints#12737
bhumin18 wants to merge 14 commits into
inventree:masterfrom
bhumin18:enhance-remaining-api-search-fields

Conversation

@bhumin18

Copy link
Copy Markdown
Contributor

Summary

This PR improves search and ordering capabilities across remaining REST API endpoints:

  1. machine/api.py (MachineList - /api/machine/):

    • Add machine_type and driver to search_fields = ['name', 'machine_type', 'driver'].
  2. stock/api.py:

    • StockLocationTypeList (/api/stock/location-type/): Add description to search_fields = ['name', 'description'].
    • StockTrackingList (/api/stock/track/): Add tracking user (user__username, user__first_name, user__last_name), title, and stock item details (item__part__name, item__part__IPN, item__serial) to search_fields.
  3. importer/api.py:

    • DataImportSessionList (/api/importer/session/): Add missing search_fields = ['model_type', 'user__username', 'user__first_name', 'user__last_name'].
    • DataImportColumnMappingList (/api/importer/column-mapping/): Add missing search_fields = ['column_label', 'field_name'] and ordering_fields = ['column_label', 'field_name', 'session'].
  4. report/api.py (ReportAssetList - /api/report/asset/):

    • Add filter_backends = SEARCH_ORDER_FILTER, search_fields = ['description'], and ordering_fields = ['description'].

@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit a5e324b
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a9e361a02dad0000826f49c

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.15%. Comparing base (9bc5054) to head (a5e324b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12737      +/-   ##
==========================================
- Coverage   87.17%   87.15%   -0.03%     
==========================================
  Files        1486     1486              
  Lines      101206   101211       +5     
  Branches    11524    11612      +88     
==========================================
- Hits        88228    88211      -17     
- Misses      12916    12938      +22     
  Partials       62       62              
Flag Coverage Δ
backend 91.18% <90.47%> (-0.01%) ⬇️

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

Components Coverage Δ
Backend Apps 92.48% <90.00%> (+<0.01%) ⬆️
Backend General 94.71% <ø> (ø)
Frontend 79.71% <ø> (-0.05%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat

Copy link
Copy Markdown
Member

I would like to take a step back and consider how adding all these additional search fields will impact search performance. We already see search performance degrading on installs with very large data sets - additional search fields only make this take more time

@bhumin18

bhumin18 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @SchrodingersGat, thank you for the feedback. That makes complete sense regarding search performance on large datasets.

I have updated the PR to address this:

  1. StockTrackingList: Reverted search_fields back to ['notes'] to completely eliminate heavy multi-table foreign-key joins (part__*, user__*, item__*) on the high-volume tracking table.
  2. DataImportSessionList: Removed user__* joined search fields.
  3. Kept only lightweight direct text fields on small configuration/metadata endpoints (MachineList, ReportAssetList, StockLocationTypeList, DataImportColumnMappingList).

Also merged latest master and resolved the conflict in api_version.py (bumped to 543).

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.

2 participants