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

Search Algorithm Issues #62

Open
LTR14 opened this issue Jun 26, 2023 · 0 comments
Open

Search Algorithm Issues #62

LTR14 opened this issue Jun 26, 2023 · 0 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@LTR14
Copy link
Collaborator

LTR14 commented Jun 26, 2023

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.

@LTR14 LTR14 added bug Something isn't working documentation Improvements or additions to documentation labels Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant