culturesofknowledge / emlo-project

Repository to manage the upgrade, development and maintenance of EMLO
0 stars 0 forks source link

Strange results from work search #257

Closed J4bbi closed 1 year ago

J4bbi commented 1 year ago

In the search works, some of the searches are calling up strange results, e.g. Author/sender starts with "New" brings up, as the 4th letter result, a letter with the author ‘Locke, Thomas’ (which is obviously not a name that begis with ‘New’): image

Or, if you do an ‘Addressee starts with Lewis’ search you get Thiery, Louis. This means it’s not just searching on the primary name, but rather on the synonyms, so all sorts of strange results are thrown up. e.g. image

Rather than in EMLO-Edit-Old: image

Incidentally, this isn’t the case with ‘Author starts with …’ searches, so it’s drawing on the primary name field in that search.

J4bbi commented 1 year ago

This happens for a valid reasons.

Whereas before, there would be a pre-populated free text field with names, synonyms, roles now, each field is independently searched.

In the example mentioned here, searching on authors starts with new results in a SQL query like so:

SELECT "cofk_union_work"."work_id", "cofk_union_work"."description", "cofk_union_work"."date_of_work_as_marked", "cofk_union_work"."original_calendar", "cofk_union_work"."date_of_work_std", "cofk_union_work"."date_of_work_std_gregorian", "cofk_union_work"."date_of_work_std_year", "cofk_union_work"."date_of_work_std_month", "cofk_union_work"."date_of_work_std_day", "cofk_union_work"."date_of_work2_std_year", "cofk_union_work"."date_of_work2_std_month", "cofk_union_work"."date_of_work2_std_day", "cofk_union_work"."date_of_work_std_is_range", "cofk_union_work"."date_of_work_inferred", "cofk_union_work"."date_of_work_uncertain", "cofk_union_work"."date_of_work_approx", "cofk_union_work"."authors_as_marked", "cofk_union_work"."addressees_as_marked", "cofk_union_work"."authors_inferred", "cofk_union_work"."authors_uncertain", "cofk_union_work"."addressees_inferred", "cofk_union_work"."addressees_uncertain", "cofk_union_work"."destination_as_marked", "cofk_union_work"."origin_as_marked", "cofk_union_work"."destination_inferred", "cofk_union_work"."destination_uncertain", "cofk_union_work"."origin_inferred", "cofk_union_work"."origin_uncertain", "cofk_union_work"."abstract", "cofk_union_work"."keywords", "cofk_union_work"."work_is_translation", "cofk_union_work"."incipit", "cofk_union_work"."explicit", "cofk_union_work"."ps", "cofk_union_work"."original_catalogue", "cofk_union_work"."accession_code", "cofk_union_work"."work_to_be_deleted", "cofk_union_work"."iwork_id", "cofk_union_work"."editors_notes", "cofk_union_work"."edit_status", "cofk_union_work"."relevant_to_cofk", "cofk_union_work"."creation_timestamp", "cofk_union_work"."creation_user", "cofk_union_work"."change_timestamp", "cofk_union_work"."change_user", "cofk_union_work"."uuid" FROM "cofk_union_work" WHERE EXISTS(SELECT (1) AS "a" FROM "cofk_union_work" U0 INNER JOIN "cofk_work_person_map" U1 ON (U0."work_id" = U1."work_id") LEFT OUTER JOIN "cofk_union_person" U2 ON (U1."person_id" = U2."person_id") WHERE (U1."relationship_type" IN (created) AND (UPPER(U2."date_of_birth_year"::text) LIKE UPPER(new%) OR UPPER(U2."date_of_death_year"::text) LIKE UPPER(new%) OR UPPER(U2."date_of_death_is_range"::text) LIKE UPPER(new%) OR UPPER(U2."date_of_birth_is_range"::text) LIKE UPPER(new%) OR UPPER(U2."foaf_name"::text) LIKE UPPER(new%) OR UPPER(U2."skos_altlabel"::text) LIKE UPPER(new%) OR UPPER(U2."person_aliases"::text) LIKE UPPER(new%)) AND U0."work_id" = ("cofk_union_work"."work_id")) LIMIT 1) ORDER BY "cofk_union_work"."date_of_work_std" ASC

Miranda is used to starts with searching on the block of text that would contain the sum of all these fields, invariably with the person's name first.