project-lux / lux-marklogic

Code, issues, and resources related to LUX MarkLogic
Other
3 stars 2 forks source link

Provide script to identify which documents resolved keyword search criteria #71

Closed brent-hartwig closed 3 months ago

brent-hartwig commented 3 months ago

Problem Description: Given the semantic aspect of the keyword search pattern, it can be time consuming to determine which documents keywords were found in. A script is desired to help validate whether a document should or should not be included by a keyword search.

Expected Behavior/Solution: After providing the starting document's URI and keywords, the script is to identify whether the specified document and/or related documents resolved the search criteria, by keyword.

Requirements: See expected behavior/solution.

Needed for promotion: If an item on the list is not needed, it should be crossed off but not removed.

UAT/LUX Examples: Starting with Benjamin Franklin's record, determine if/where 'franklin', 'boston', and 'naval academy' appear.

{
   "parameters":{
      "subjectUri":"https://lux.collections.yale.edu/data/person/098de228-41f2-404e-83e2-e48b2bd632f8",
      "scopeName":"agent",
      "keywords":[
         "boston",
         "franklin",
         "naval academy"
      ],
      "maxObjectsToCheck":100
   },
   "configuration":{
      "predicate":"https://lux.collections.yale.edu/ns/agentAny",
      "subjectFieldName":"agentAnyText",
      "objectFieldName":"referencePrimaryName"
   },
   "subject":{
      "matchedAll":false,
      "matches":{
         "boston":true,
         "franklin":true,
         "naval academy":false
      }
   },
   "objects":{
      "objectsNotSearched":0,
      "matchedAll":[

      ],
      "matches":{
         "boston":[
            "https://lux.collections.yale.edu/data/place/45f37f2c-dd03-4c21-9be3-3836989598da"
         ],
         "franklin":[
            "https://lux.collections.yale.edu/data/group/dbb6d7a4-81e6-42e0-8271-148dc41084da"
         ],
         "naval academy":[
            "https://lux.collections.yale.edu/data/group/8cd78172-66a8-401b-87e9-04f4b0d87a82"
         ]
      },
      "uris":[
         "https://lux.collections.yale.edu/data/place/45f37f2c-dd03-4c21-9be3-3836989598da",
         "https://lux.collections.yale.edu/data/place/6888a2b1-47a2-41d4-a956-e59baf89af37",
         "https://lux.collections.yale.edu/data/group/dbb6d7a4-81e6-42e0-8271-148dc41084da",
         "https://lux.collections.yale.edu/data/group/eef6d82c-fb19-47f0-acc7-ad4dbbae45e0",
         "https://lux.collections.yale.edu/data/group/ef438d5d-b295-4daf-916e-a0e3f37c7ee5",
         "https://lux.collections.yale.edu/data/group/8cd78172-66a8-401b-87e9-04f4b0d87a82",
         ...
      ]
   }
}

Dependencies/Blocks: Script is dependent on some of LUX's code:

import { FULL_TEXT_SEARCH_RELATED_FIELD_NAME } from '/lib/appConstants.mjs';
import { getSearchScope } from '/lib/searchScope.mjs';

Related Github Issues: None.

Related links: None.

Wireframe/Mockup: N/A

brent-hartwig commented 3 months ago

Addressed in PR https://github.com/project-lux/lux-marklogic/pull/72