buda-base / public-digital-library

http://library.bdrc.io
5 stars 6 forks source link

improvements in etext results UX #907

Open eroux opened 3 months ago

eroux commented 3 months ago

Let's improve the UX of search results in the following way:

roopeux commented 3 months ago

@berger-n , the three ideas of Élie can be covered like this:

berger-n commented 3 months ago

ok @roopeux thanks! then we'll need to add a few things to the results, for each hit inside a given text:

I'm also wondering about the use cases of the etext search, isn't it supposed to provide exhaustive results in a given text? which could be available from a page like https://library-dev.bdrc.io/show/bdr:MW1PD152291 (displaying a Find in this text field but no results by default)

eroux commented 3 months ago

thanks @berger-n !

Normally the results contain the whole matching chunks (just not in the highlights section unfortunately), perhaps that would be enough for the full snippet? The full chunks are objects that also contain the startChar / endChar

Currently the only search implemented is the general search, but yes we need to implement the full search in an etext or etext instance.

In theory restricting the search to a certain etext or etext instance should be as simple as using associatedRes

berger-n commented 3 months ago

oh ok I see, thanks! so I'm afraid something's missing, here's the first result for https://library-dev.bdrc.io/osearch/search?q=spyod%20%27jug&etext_search%5B0%5D=true:

{
    "_id": "MW00EGS1016761",
    "_index": "bdrc_prod",
    "_score": 0.023055173,
    "_source": {
        "altLabel_bo_x_ewts": [
            "dpal gsang chen rnying ma'i chos spyod zab bcud rin po che'i gter mdzod/"
        ],
        "altLabel_en": [
            "Dpal gsang chen rnying ma'i chos spyod zab bcud rin po che'i gter mdzod =A collection of daily practices of Nyingmapa school /by Dpal-ldan-shes-rab."
        ],
        "associated_res": [
            "WA00EGS1016761",
            "T1082",
            "T225",
            "PR3JW7543"
        ],
        "authorshipStatement_en": [
            "by mkhan-chen dpal-ldan-shes-rab"
        ],
        "comment_en": [
            "collection of devotional works of the rnying ma tradition",
            "tbrc copy missing second title page",
            "Scanned at M/S Satluj Infotech Images, E-45, Sector 27 Noida, District Gautam Buddha Nagar, U.P. 201301 via New Delhi, India for the Buddhist Digital Resource Center."
        ],
        "creation_date": "2006-12-04T18:39:54.187Z",
        "db_score": 0.5002899,
        "db_score_in_type": 0.5002899,
        "etext_access": 3,
        "etext_quality": 2,
        "firstScanSyncDate": "2016-03-30T16:20:30.571Z",
        "graphs": [
            "MW00EGS1016761"
        ],
        "join_field": "instance",
        "language": [
            "LangBo"
        ],
        "merged": [
            "WA00EGS1016761",
            "W00EGS1016761"
        ],
        "other_id": [
            "014253880",
            "BQ7662.6 .D65 2000",
            "2001293793",
            "008982196-3"
        ],
        "pop_score": 0.4045376181602478,
        "pop_score_in_type": 0.4045376181602478,
        "pop_score_rk": 0.4045376181602478,
        "prefLabel_bo_x_ewts": [
            "dpal gsang chen rnying ma sgo chen rgyal ba'i ri khrod bdud 'dul gsang sngags gling dgon gyi chos spyod gces btus zab bcud rin po che'i gter mdzod/"
        ],
        "prefLabel_en": [
            "the treasury of jewels : a collection of essential nyingmapa prayers and practices"
        ],
        "printMethod": [
            "PrintMethod_Modern"
        ],
        "publicationDate": "2000",
        "publisherLocation_en": [
            "sarnath, varanasi"
        ],
        "publisherName_en": [
            "pema samye chokor ling"
        ],
        "scans_access": 5,
        "scans_freshness": 0.023588656,
        "script": [
            "ScriptTibt"
        ],
        "summary_en": [
            "Collection of Nyingma prayers and practices, edited by Gochen Khenpo Palden Sherab (1938-2010)."
        ],
        "type": [
            "Instance"
        ],
        "workGenre": [
            "T225"
        ],
        "workIsAbout": [
            "T1082"
        ]
    },
    "inner_hits": {
        "etext": {
            "hits": {
                "hits": [
                    {
                        "_id": "UTIE0OPI40212F00_I01JW66",
                        "_index": "bdrc_prod",
                        "_routing": "MW00EGS1016761",
                        "_score": 2.3948097,
                        "_source": {},
                        "highlight": {
                            "chunks.text_bo": [
                                "བསྟོད་དང། གནས་བརྟན\nབཅུ་དྲུག་ཕྱག་མཆོད། 51-63 འཕགས་པ་བཀྲ་ཤིས་བརྒྱད་པ། 63-66 ཕྱོགས་བཅུའི་མུན་སེལ། 66-68 <em>སྤྱོད</em>",
                                "་<em>འཇུག</em>་མཆོད་པདང། མཎྜལ་སོ་བདུན་མ། 69-74 སྡོམ་གསུམ་བླ་\n\n༄༅།། བརྒྱུད་གསོལ་འདེབས། 74-88 ཨོ་རྒྱན་བླ་མ་རྒྱངས",
                                "<em>སྤྱོད</em>་<em>འཇུག</em>་ལས་གསུངས་པའི་མཆོད་པ་འབུལ་བའི་ཚུལ་ནི། རིན་ཆེན་སེམས་དེ་བཟུང་བར་བྱ་བའི་ཕྱིར། དེ་བཞིན་གཤེགས་པ་",
                                "བགྲོད་པའི་གྲུ་བོ་ཆེ་དར་གཅིག་ཏུ་གནས་པར་བྱ་བའི་བློས་བཟའ་བར་བྱ་ཡི། \nཆགས་པ་དང་སྲེད་པ་འཕེལ་བའི་བློས་མི་བཟའོ། <em>སྤྱོད</em>",
                                "་<em>འཇུག</em>་ལས། རན་པ་ཙམ་དུ་བཟའ་བར་བྱ། ཞེས་པས་དེའི་ཚུལ་ནི་ཡན་ལག་བརྒྱད་པར་ལུས་ཀྱི་ཆ་གཉིས་ཟས། གཅིག་སྐོམ། གཅིག་"
                            ]
                        }
                    }
                ],
                "max_score": 2.3948097,
                "total": {
                    "relation": "eq",
                    "value": 1
                }
            }
        }
    }
}
eroux commented 3 months ago

ah, that's interesting, something's missing indeed... it should be fixed in the new version I just deployed

berger-n commented 3 months ago

not far from done: https://library-dev.bdrc.io/osearch/search?q=spyod%20%27jug&etext_search%5B0%5D=true

simplescreenrecorder-2024-08-13_18 50 39 mkv


note that when the snippet is expanded, the highlighting is made in the client and thus not perfect:

image


it wouldn't hurt to have a See all results button next to More, would it? though I couldn't make the associated_res query work for now (link)

roopeux commented 2 months ago

This looks good to me. Is there something still to be done?

berger-n commented 1 month ago

fixed highlighting in expanded matches: https://library-dev.bdrc.io/osearch/search?q=tshal%20bu%20AND%20dbu%20med&associatedTradition%5B0%5D=TraditionNyingma

image