Commit graph

58 commits

Author SHA1 Message Date
Aarol D'Souza
9eef4f6dae
fix: force type check in whitelisted methods (#37044)
* fix(contact): force type check in contact whitelisted methods

* fix(google_indexing): force type check in google_indexing whitelisted methods

* fix(assignment_rule): add type checks to assignment_rule whitelisted methods

* refactor: remove unused args

* fix(queue): add type hints to whitelisted methods in queue.py

* fix(auto_email_report): add type hints to whitelisted methods

* fix(dashboard): add type hints to whitelisted methods

* fix(sidebar_item_group): add type hints to whitelisted methods

* fix(weasyprint): add type hints to whitelisted methods

* fix(backups): add type hints to whitelisted methods

* fix(document_naming_settings): add type hints to whitelisted methods

* fix(get_latest_submissions): add type hints to whitelisted methods

* fix(custom_field): add type hints to whitelisted methods

* fix(customize_form): add type hints to whitelisted methods

* fix(personal_data_deletion_request): add type hints to whitelisted functions

* fix(__init__): add type hints to whitelisted methods

* fix(prepared_report): add type hints to whitelisted methods

* fix(session_default_settings): add type hints to whitelisted methods

* fix(document_follow): add type hints to whitelisted methods

* fix(route_history): add type hints to whitelisted methods

* fix(form_tour): add type hints to whitelisted methods

* fix(dashboard_settings): add type hints to whitelisted methods

* fix(address): add type hints to whitelisted methods

* fix(contact): add type hints to whitelisted methods

* fix(discussion_reply): add type hints to whitelisted methods

* fix(auto_repeat): add type hints to whitelisted methods

* fix: add the missing type hints and misc. corrections

* fix(email): add type hints to whitelisted methods

* fix(permitted_documents_for_users): add type hints to whitelisted methods

* fix: correct the type hints

* fix: int PK types

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2026-02-17 15:16:30 +00:00
Ritvik Sardana
aef35985a3 fix: doctype indexing progress 2026-02-07 19:21:03 +05:30
Ritvik Sardana
6f88468d68 refactor: resumable indexing without max_runtime 2026-02-06 15:05:52 +05:30
Faris Ansari
2a7e6a7793 refactor: resumable search index 2026-02-06 15:05:41 +05:30
Ankush Menat
01c6a55031
perf: random memory optimizations (#36102)
* perf: preload mysqlclient

Now the default choice instead of PyMySQL.

* perf: Lazy load JWT

OAuth is not used that frequently, on that many sites.

* perf: Lazy load whoosh

Rarely loaded
2026-01-20 06:57:19 +00:00
Faris Ansari
1f9460f1c2 fix: deduplicate documents in search index while updating 2025-12-31 18:06:44 +05:30
Ankush Menat
5922f29806 chore: remove unncessary print 2025-12-17 16:30:46 +05:30
Faris Ansari
7c49237913
Merge pull request #33502 from netchampfaris/sqlite-search-fixes
fix: wrap doc index update in try block
2025-08-01 00:37:44 +05:30
Faris Ansari
952ee8f22e fix: add support for like filter 2025-07-31 23:29:06 +05:30
Faris Ansari
d2ca1d63f4 fix: wrap doc index update in try block
failure in index update shouldn't affect document lifecycle
2025-07-31 23:02:52 +05:30
Faris Ansari
d9cb5a247a
fix: better title boost logic (#33476) 2025-07-29 13:21:09 +05:30
Faris Ansari
2676c9c2ec
feat: SQLite FTS5 search framework for Frappe apps (#33359)
- Abstract SQLiteSearch base class with full-text search
- Spelling correction, recency boosting, and custom scoring
- Supports search filtering and configurable document indexing
- hooks for auto-indexing
  - build index after migrate
  - build index (if not exists) every 15 mins
  - update doc index on_update
  - remove doc index on_trash
2025-07-29 11:18:56 +05:30
Akhil Narang
a7aa0ded2d
refactor: change filter from tuple to dict
While list/dict both work and technically so does a tuple,
the original intention in #13831 seems to have been a dict.
A trailing comma got left behind, which changed it to a tuple.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-11-26 11:38:15 +05:30
David Arnold
c114e5fae8
refactor: unit vs integration treewide (#27992)
* refactor: constitute unit test case

* fix: docs and type hints

* refactor: mark presumed integration test cases explicitly

At time of writing, we now have at least two base test classes:

- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase

They load in their perspective priority queue during execution.

Probably more to come for more efficient queing and scheduling.

In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.

* feat: Move test-related functions from test_runner.py to tests/utils.py

* refactor: add bare UnitTestCase to all doctype tests

This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
2024-10-06 09:43:36 +00:00
gavin
3544b87f58
fix(website_search): Avoid recursive loop if _items_to_index is falsy 2024-08-27 14:11:37 +02:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
Ankush Menat
8107781f1c
fix: move filelock imports to functions (#19300) 2022-12-15 15:21:31 +05:30
Ankush Menat
49437f53b4
feat: operation level locking for CLI commands (#19162)
This prevents mistakenly issuing same commands twice which can be
dangerous.

added global lock(s):
- [x] bench build

added site level lock(s):
- [x] bench new-site sitename
- [x] bench --site sitename migrate
- [x] bench install-app appname
- [x] bench build
- [x] bench restore (the code is just meh, needs some cleanup)

closes https://github.com/frappe/frappe/issues/13215
2022-12-08 13:24:43 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
ChillarAnand
3f21b6707a fix: Use whoosh AsyncWriter to prevent write locks 2022-02-06 08:40:23 +05:30
Ankush Menat
99a6874aff feat: apply boosts on search queries
This gives higher priority to title and match over content.
2021-10-25 09:14:53 +05:30
Ankush Menat
4ef4ecdf01 fix: dont hardcode search fields
FullTextSearch uses name and content
WebsiteSearch uses title and content

Tests were failing because of hardcoded fieldnames which can't be
overridden by inheriting class without rewriting search function.

Made a separate function for defining search fields.
2021-10-25 09:14:48 +05:30
Ankush Menat
56f5b3d1f3 test: make global search tests less flaky 2021-10-24 14:46:02 +05:30
Ankush Menat
cbe673255b fix(ux): allow fuzzy search in website search
FuzzyTerm allows edit distance based fuzzy searching. This means "webho" or
"wabhool" will match "webhook".
2021-10-24 14:46:02 +05:30
ChillarAnand
a298566d13 fix: Use whoosh AsyncWriter to prevent write locks 2021-09-15 16:42:11 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Mohammad Hasnain Mohsin Rajan
b4453396f4
fix: website_content_field based indexing fails since fields are not passed correctly(#13907) 2021-08-11 12:23:03 +05:30
Mohammad Hasnain Mohsin Rajan
e9076a1e33
fix: Get title only when necessary (#13831)
* fix: query only if necessary

* fix: titile not found

* chore: linting

* chore: use `not in`

* chore: translate title

* chore: quotes

* chore: quotes
2021-08-04 07:54:56 +00:00
Mohammad Hasnain Mohsin Rajan
266a5511c9
chore: fix sider 2021-07-27 12:31:34 +05:30
hasnain2808
48bc68c130 Merge branch 'develop' of https://github.com/frappe/frappe into add-route-index-build-as-a-background-job 2021-06-20 15:59:17 +05:30
hasnain2808
c7d7c54e2c feat: better indexing 2021-06-18 11:06:52 +05:30
hasnain2808
e71ae4b3fe fix: title needed too 2021-06-18 00:25:31 +05:30
hasnain2808
9bea81e30c feat: website_search_field in doctype doctype
website_search_field to declare the content field
remove the background job execution of search indexing
2021-06-18 00:12:07 +05:30
Suraj Shetty
c5b9815248 fix: Add get_response_content to get page content 2021-05-14 23:43:36 +05:30
Suraj Shetty
18497989dc refactor: Remove render_page from render.py
& replace all usages of render_page with get_response
2021-05-14 21:30:28 +05:30
Gavin D'souza
134b2dcd5c chore: Remove f prefix on plain string 2021-05-11 13:02:45 +05:30
Gavin D'souza
1752e5b0e5 feat(cli): Show progress bar for website search index building 2021-05-07 12:14:00 +05:30
Rushabh Mehta
b2686e0623 fix(routing): removed /space from routing 2021-01-01 12:30:35 +05:30
Shivam Mishra
8772606103 fix: document None is not subscriptable 2020-08-26 11:38:29 +05:30
Shivam Mishra
24c5fbf743 test: fix tests 2020-08-10 21:34:02 +05:30
Shivam Mishra
8d71dad60b feat: delete doc only if valid name is provided 2020-08-10 14:24:00 +05:30
Shivam Mishra
579f5dfc8b fix: test conditions 2020-08-10 14:23:44 +05:30
Shivam Mishra
c72a19f696 fix: reference errors in test 2020-08-10 13:52:11 +05:30
Shivam Mishra
b76a01f28d refactor: add set admin to finally 2020-08-10 12:50:37 +05:30
Shivam Mishra
38909db955 feat: create index if not exists 2020-08-06 19:47:46 +05:30
Shivam Mishra
eab9a27b61 feat: separate create_index function 2020-08-06 19:47:46 +05:30