You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source: (Any branch) PPUC/PxPUC/view.py in ResearcherSearchList
Description: The for loop within the get_queryset method in ResearcherSearchList handles the algorithm. This loop takes the users full string and iteratively shortens it until it is just the first word of the query. This is what cur_query is each iteration. The prefetch_queryset is a queryset of sentences that contain the current query at that specific iteration while count_query_filter gets a count of how many sentences contain the current query. The sentence_queryset (which is actually a queryset for location objects) takes both of these variables into consideration. First it annotates a new field for every location for the count of sentences that contain the current query, then it connects all of the locations to their corresponding sentences from the prefetch_queryset. It excludes all locations that have a count of 0 sentences. The letter_grade assigned to each location is simply considering the iteration of the loop and giving it an alphabet letter associated with it in ASCII (such that A = 65, B = 66, and so on). These locations are then added to the main queryset iteratively until the loop stops. This queryset is returned. Some issues with this involve the ranking being done at such a high level, on the location level as opposed to the sentence level. Another issue comes with sorting, which is done on the frontend but is not handled efficiently or consistently. Whether this is a bug or a product of the algorithm is difficult to tell with certainty.
Solution: Move the sorting to the backend. This may have some issues as SQLite sometimes causes a fuss with complex Django operations. Also assign a rank on the sentence level instead and connect to location accordingly.
The text was updated successfully, but these errors were encountered:
Source: (Any branch) PPUC/PxPUC/view.py in ResearcherSearchList
Description: The for loop within the get_queryset method in ResearcherSearchList handles the algorithm. This loop takes the users full string and iteratively shortens it until it is just the first word of the query. This is what cur_query is each iteration. The prefetch_queryset is a queryset of sentences that contain the current query at that specific iteration while count_query_filter gets a count of how many sentences contain the current query. The sentence_queryset (which is actually a queryset for location objects) takes both of these variables into consideration. First it annotates a new field for every location for the count of sentences that contain the current query, then it connects all of the locations to their corresponding sentences from the prefetch_queryset. It excludes all locations that have a count of 0 sentences. The letter_grade assigned to each location is simply considering the iteration of the loop and giving it an alphabet letter associated with it in ASCII (such that A = 65, B = 66, and so on). These locations are then added to the main queryset iteratively until the loop stops. This queryset is returned. Some issues with this involve the ranking being done at such a high level, on the location level as opposed to the sentence level. Another issue comes with sorting, which is done on the frontend but is not handled efficiently or consistently. Whether this is a bug or a product of the algorithm is difficult to tell with certainty.
Solution: Move the sorting to the backend. This may have some issues as SQLite sometimes causes a fuss with complex Django operations. Also assign a rank on the sentence level instead and connect to location accordingly.
The text was updated successfully, but these errors were encountered: