From 835345f826e143d89fe4a85c3a322e0f307fe1a5 Mon Sep 17 00:00:00 2001 From: Shankhadeep Date: Wed, 2 Oct 2019 13:57:24 +0530 Subject: [PATCH 1/4] Changing created to modified time --- readthedocs/search/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/search/tasks.py b/readthedocs/search/tasks.py index 02202db07e0..7394cab23df 100644 --- a/readthedocs/search/tasks.py +++ b/readthedocs/search/tasks.py @@ -160,7 +160,7 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s project__slug=project_slug, version__slug=version_slug, created__gte=before_10_sec, - ).order_by('-created') + ).order_by('-modified') # check if partial query exists, # if yes, then just update the object. @@ -210,5 +210,5 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s version=version, query=query, ) - obj.created = time + obj.modified = time obj.save() From 1b23d479f4615caa560dddfb766b361a3f36a502 Mon Sep 17 00:00:00 2001 From: Shankhadeep Date: Wed, 2 Oct 2019 15:54:16 +0530 Subject: [PATCH 2/4] Changing what was reuqested --- readthedocs/search/tasks.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readthedocs/search/tasks.py b/readthedocs/search/tasks.py index 7394cab23df..e5a9dfbf522 100644 --- a/readthedocs/search/tasks.py +++ b/readthedocs/search/tasks.py @@ -159,7 +159,7 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s partial_query_qs = SearchQuery.objects.filter( project__slug=project_slug, version__slug=version_slug, - created__gte=before_10_sec, + modified__gte=before_10_sec, ).order_by('-modified') # check if partial query exists, @@ -210,5 +210,3 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s version=version, query=query, ) - obj.modified = time - obj.save() From 599a4765deed61c9f17f489f2b77fea73f92948f Mon Sep 17 00:00:00 2001 From: Shankhadeep Date: Wed, 2 Oct 2019 16:11:17 +0530 Subject: [PATCH 3/4] Removing obj which is unused --- readthedocs/search/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/search/tasks.py b/readthedocs/search/tasks.py index e5a9dfbf522..d3bb2e4d97c 100644 --- a/readthedocs/search/tasks.py +++ b/readthedocs/search/tasks.py @@ -205,7 +205,7 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s version = version_qs.first() # make a new SearchQuery object. - obj = SearchQuery.objects.create( + SearchQuery.objects.create( project=project, version=version, query=query, From dd8da168d2b58c46f74a57d5ed17fda2178e4367 Mon Sep 17 00:00:00 2001 From: Shankhadeep Date: Mon, 14 Oct 2019 21:42:26 +0530 Subject: [PATCH 4/4] Deleting 'partial_query.created = time' --- readthedocs/search/tasks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/readthedocs/search/tasks.py b/readthedocs/search/tasks.py index d3bb2e4d97c..98687f33fff 100644 --- a/readthedocs/search/tasks.py +++ b/readthedocs/search/tasks.py @@ -166,7 +166,6 @@ def record_search_query(project_slug, version_slug, query, total_results, time_s # if yes, then just update the object. for partial_query in partial_query_qs.iterator(): if query.startswith(partial_query.query): - partial_query.created = time partial_query.query = query partial_query.save() return