BuddhaNexus / buddhanexus-frontend-next

BuddhaNexus Frontend 2.0
buddhanexus-frontend-next.vercel.app
2 stars 1 forks source link

Update global search endpoint #122

Closed aminahbl closed 1 month ago

aminahbl commented 5 months ago

Items needed:

sebastian-nehrdich commented 5 months ago

I have modified this endpoint, it now returns this (display name still missing, one thing at a time :D): { "searchResults": [ { "_key": "57180520", "_id": "search_index_skt/57180520", "_rev": "_hTeL-_2--m", "segment_nr": [ "T06sthtvbhu:844-846" ], "category": "T06", "language": "skt", "file_name": "T06sthtvbhu", "distance": 0, "similarity": 100, "segtext": [ { "text": " ", "highlightColor": 0 }, { "text": "yena yena vikalpena", "highlightColor": 1 }, { "text": " yad yad vastu vikalpyate / parikalpita evāsau svabhāvo na sa vidyate // 20 ādhyātmikabāhyavikalpyavastubhedena vikalpānām ānantyaṃ pradarśayann āha /", "highlightColor": 0 } ] },

sebastian-nehrdich commented 5 months ago

Just added the full names, apart from the language filtering this should now have everything.

sebastian-nehrdich commented 5 months ago

I have added the language filter parameter now, this should all work now as desired.

aminahbl commented 5 months ago

Hey @sebastian-nehrdich, thanks so much! I'm just implementing these changes on the frontend at the moment. I'll handle the lang param, and I think the only thing remaining is pagination.


At the minute it looks like the endpoint is down:

{
    "detail": [
        {
            "loc": [
                "body",
                "language"
            ],
            "msg": "field required",
            "type": "value_error.missing"
        }
    ]
}
sebastian-nehrdich commented 5 months ago

I don't think pagination is inherently necessary. We have a hard limit of 200 search results, and the actual stress is more in the python post processing (Levenshtein distance) than the actual database query, so I'd opt to just go for a hard limit of max. 200 results and we shouldn't need pagination then. What do you think?

On Sun, Feb 4, 2024 at 9:58 AM aminahbl @.***> wrote:

Hey @sebastian-nehrdich https://github.com/sebastian-nehrdich, thanks so much! I'm just implementing these changes on the frontend at the moment. I'll handle the lang param, and I think the only thing remaining is pagination.

— Reply to this email directly, view it on GitHub https://github.com/BuddhaNexus/buddhanexus-frontend-next/issues/122#issuecomment-1925865217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEPC7GCVEKGLMM3QQ2B6K4DYR7D27AVCNFSM6AAAAABCUOJBE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVHA3DKMRRG4 . You are receiving this because you were mentioned.Message ID: @.***>

aminahbl commented 5 months ago

I didn't know about the hard limit. From this point of view, no, perhaps pagination isn't essential. It will require a little modification to the UI as the limit will need to be communicated to the user if the 200 cap is exceed.

sebastian-nehrdich commented 5 months ago

Yes I think buddhanexus is also not the place to do exhaustive searches, so if a user plans to look at more than 200 results they should rather use dedicated tools for that purpose. These search requests are computationally not very cheap…

On Mon, Feb 5, 2024 at 3:06 AM aminahbl @.***> wrote:

I didn't know about the hard limit. From this point of view, no, perhaps pagination isn't essential. It will require a little modification to the UI as the limit will need to be communicated to the user if the 200 cap is exceed.

— Reply to this email directly, view it on GitHub https://github.com/BuddhaNexus/buddhanexus-frontend-next/issues/122#issuecomment-1926730482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEPC7GAXBLKIOEJHVSIONDLYSC4JXAVCNFSM6AAAAABCUOJBE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRWG4ZTANBYGI . You are receiving this because you were mentioned.Message ID: @.***>