Closed EtcetFelix closed 2 weeks ago
This is awesome! One thing: could you make it so that the search feature is case insensitive (i.e. 'Robot' matches with 'robot', 'ROBOT', 'rObot', etc)?
Unfortunately, there's 2 problems with this current implementation:
DynamoDB does not allow for case insensitive searching. The only solutions are to store the title and description twice, one for searching, the other for user display. Related: https://stackoverflow.com/questions/44284045/query-dynamodb-with-case-insensitive-condition Related: https://dynobase.dev/dynamodb-faq/is-it-possible-to-make-a-dynamodb-table-case-insensitive/
Filter Expressions are applied after the query is done and before results are returned. That's a problem because query has a max limit of returning 1MB of data. Therefore, scanning the table should be avoided in favor of some filtering search criteria for pagination. This goes for non user search queries as well. Related: https://www.alexdebrie.com/posts/dynamodb-filter-expressions/ Related: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.Pagination.html
Therefore, I propose merging this PR for now, and opening 2 tasks for the following: Task 1: Fix db writes to add a new field for searching with case-insensitive queries, and change the dynamo db searches to search on that field Task 2: Replace all table.scan operations with either a DynamoDB query method with pagination, or query with boto3 (since the AWS boto sdk provides low level pagination abstraction: https://docs.aws.amazon.com/code-library/latest/ug/python_3_dynamodb_code_examples.html#scenarios)
Bah, unfortunate. I'll open the two issues you have just mentioned and merge the request.
Resolves #154
What does this PR do?
Adds the search feature for the Robots page and the Parts page, including necessary frontend and backend changes.
What issues does this PR fix or reference?
Search Feature