freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
550 stars 151 forks source link

4312 Introduced score field in the V4 Search API results #4712

Closed albertisfu closed 12 hours ago

albertisfu commented 1 day ago

As requested in #4312, this PR introduces the score field into the V4 Search API results for all search types.

We already have the meta field in V4 Search results, so I believe it makes sense to include the score within this field.

Additionally, since we plan to implement other ranking algorithms in the future to display alternative scores, it seems more appropriate to use the hash approach for this purpose. Currently, it only includes bm25, which is the score returned by Elasticsearch.

"meta": {
                "timestamp": "2024-06-22T10:26:35.320787Z",
                "date_created": "2022-06-26T23:24:18.926040Z",
                "score": {
                    "bm25": 2.1369965
                }
            }

The score is only displayed for main documents across all search types. Nested documents do not include the score field in their meta section.

Screenshot 2024-11-20 at 2 46 19 p m

Full example:

"results": [
        {
            "assignedTo": null,
            "assigned_to_id": null,
            "attorney": [],
            "attorney_id": [],
            "caseName": "King-Barnes v. Singleton-Morgan",
            "case_name_full": "Obrien PLC, Jennings, Smith and King, Hall, Mendoza and Wagner, Villanueva Inc, and Morris and Sons v. Lisa Gaines, Tina Hardin, William Wilson, Isaac King, and Brian Stephens",
            "cause": "",
            "chapter": null,
            "court": "Superior court for the Zoo",
            "court_citation_string": "",
            "court_id": "ggywd",
            "dateArgued": "2019-01-30",
            "dateFiled": null,
            "dateTerminated": null,
            "docketNumber": "4:75-ms-196548",
            "docket_absolute_url": "/docket/1/king-barnes-v-singleton-morgan/",
            "docket_id": 1,
            "firm": [],
            "firm_id": [],
            "jurisdictionType": "",
            "juryDemand": "",
            "meta": {
                "timestamp": "2024-10-15T23:46:54.879912Z",
                "date_created": "2024-10-15T23:46:43.574769Z",
                "score": {
                    "bm25": 1.9749033
                },
                "more_docs": false
            },
            "pacer_case_id": "102713",
            "party": [
                "King-Barnes",
                "Singleton-Morgan"
            ],
            "party_id": [],
            "recap_documents": [
                {
                    "absolute_url": "",
                    "attachment_number": null,
                    "cites": [],
                    "description": "Next marriage thing woman believe bed something. Wind another whose watch. Conference must indicate field chance.\nLaugh yard election toward worry. He computer cold onto sometimes voice necessary call.\nWind finish professor I against. Easy kitchen development.\nNeed present market measure Congress. Deep author before Mr my.\nBehavior read single body.\nMake away have affect practice shake. Industry heart field become store director. Action clear actually special image child. Per country prevent culture.\nCommon course save nature perform north artist. Land cup there.\nReflect serve especially. Check sing responsibility have teach.\nOpen hear clear give. Much others five include.\nCourse before material civil. Increase capital song for.",
                    "docket_entry_id": 1,
                    "document_number": null,
                    "document_type": "PACER Document",
                    "entry_date_filed": null,
                    "entry_number": null,
                    "filepath_local": null,
                    "id": 1,
                    "is_available": false,
                    "meta": {
                        "timestamp": "2024-10-15T23:46:54.983680Z",
                        "date_created": "2024-10-15T23:46:54.644368Z"
                    },
                    "pacer_doc_id": "378240",
                    "page_count": null,
                    "short_description": "Thought nothing medical scene writer. Specific sit stop support be machine fact century.\nHair site cold agency. Action campaign fast hour.\nCharge indeed fact last.\nOwn energy high several discover. Investment free during culture. Benefit although wrong family evidence. Foreign almost health.\nLarge adult already model news compare. Summer try little medical executive lot young. Else time air piece.\nFactor view seven around Mr computer. Rather after among whether method reach free off. Price allow message total. Animal himself this boy.\nMusic wrong focus manage enter stock.\nCurrent finally former performance. Whole song save various happy maintain require right. I prevent machine rather test author food.",
                    "snippet": ""
                }
            ],
            "referredTo": null,
            "referred_to_id": null,
            "suitNature": "",
            "trustee_str": null
        }
    ]

Let me know what do you think.

mlissner commented 1 day ago

Process notes:

Looking good!

mlissner commented 12 hours ago

Thank you, this is great!