-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd21f40
commit b8e3d8a
Showing
11 changed files
with
103 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { SearchableIndexQuerySelector } from '@common/constants/complexLookup.constants'; | ||
import { SEARCH_QUERY_VALUE_PARAM } from '@common/constants/search.constants'; | ||
|
||
export const buildSearchQuery = ({ | ||
map, | ||
selector = SearchableIndexQuerySelector.Query, | ||
searchBy, | ||
value, | ||
}: BuildSearchQueryParams) => { | ||
const searchableIndex = map?.[searchBy]; | ||
|
||
return searchableIndex?.[selector]?.replaceAll(SEARCH_QUERY_VALUE_PARAM, value); | ||
}; | ||
|
||
export const buildBrowseQuery = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
export { buildSearchQuery } from './queryBuilder'; | ||
import { buildSearchQuery } from './authorities'; | ||
|
||
export const SEARCH_QUERY_BUILDER: Record< | ||
string, | ||
({ map, selector, searchBy, value }: BuildSearchQueryParams) => string | undefined | ||
> = { | ||
default: buildSearchQuery, | ||
authorities: buildSearchQuery, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 33 additions & 20 deletions
53
src/configs/complexLookup/complexLookupSeachableIndicesMap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,77 @@ | ||
import { SearchableIndex } from '@common/constants/complexLookup.constants'; | ||
import { SearchableIndex, SearchableIndexQuerySelector } from '@common/constants/complexLookup.constants'; | ||
import { SEARCH_QUERY_VALUE_PARAM, SearchSegment } from '@common/constants/search.constants'; | ||
|
||
export const COMPLEX_LOOKUP_SEARCHABLE_INDICES_MAP: SearchableIndicesMap = { | ||
[SearchSegment.Search]: { | ||
[SearchableIndex.Keyword]: { | ||
query: `(keyword=="${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(keyword=="${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.Identifier]: { | ||
query: `((identifiers.value=="${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}") and authRefType=="Authorized")`, | ||
[SearchableIndexQuerySelector.Query]: `((identifiers.value=="${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}") and authRefType=="Authorized")`, | ||
}, | ||
[SearchableIndex.LCCN]: { | ||
query: `lccn=="${SEARCH_QUERY_VALUE_PARAM}"`, | ||
[SearchableIndexQuerySelector.Query]: `lccn=="${SEARCH_QUERY_VALUE_PARAM}"`, | ||
}, | ||
[SearchableIndex.PersonalName]: { | ||
query: `(personalName all "${SEARCH_QUERY_VALUE_PARAM}" or sftPersonalName all "${SEARCH_QUERY_VALUE_PARAM}" or saftPersonalName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(personalName all "${SEARCH_QUERY_VALUE_PARAM}" or sftPersonalName all "${SEARCH_QUERY_VALUE_PARAM}" or saftPersonalName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.CorporateConferenceName]: { | ||
query: `(corporateName all "${SEARCH_QUERY_VALUE_PARAM}" or sftCorporateName all "${SEARCH_QUERY_VALUE_PARAM}" or saftCorporateName all "${SEARCH_QUERY_VALUE_PARAM}" or meetingName all "${SEARCH_QUERY_VALUE_PARAM}" or sftMeetingName all "${SEARCH_QUERY_VALUE_PARAM}" or saftMeetingName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(corporateName all "${SEARCH_QUERY_VALUE_PARAM}" or sftCorporateName all "${SEARCH_QUERY_VALUE_PARAM}" or saftCorporateName all "${SEARCH_QUERY_VALUE_PARAM}" or meetingName all "${SEARCH_QUERY_VALUE_PARAM}" or sftMeetingName all "${SEARCH_QUERY_VALUE_PARAM}" or saftMeetingName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.GeographicName]: { | ||
query: `(geographicName all "${SEARCH_QUERY_VALUE_PARAM}" or sftGeographicName all "${SEARCH_QUERY_VALUE_PARAM}" or saftGeographicName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(geographicName all "${SEARCH_QUERY_VALUE_PARAM}" or sftGeographicName all "${SEARCH_QUERY_VALUE_PARAM}" or saftGeographicName all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.NameTitle]: { | ||
query: `(personalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftPersonalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftPersonalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or corporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftCorporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftCorporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or meetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftMeetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftMeetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(personalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftPersonalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftPersonalNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or corporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftCorporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftCorporateNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or meetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftMeetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftMeetingNameTitle all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.UniformTitle]: { | ||
query: `(uniformTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftUniformTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftUniformTitle all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(uniformTitle all "${SEARCH_QUERY_VALUE_PARAM}" or sftUniformTitle all "${SEARCH_QUERY_VALUE_PARAM}" or saftUniformTitle all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.Subject]: { | ||
query: `(topicalTerm all "${SEARCH_QUERY_VALUE_PARAM}" or sftTopicalTerm all "${SEARCH_QUERY_VALUE_PARAM}" or saftTopicalTerm all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(topicalTerm all "${SEARCH_QUERY_VALUE_PARAM}" or sftTopicalTerm all "${SEARCH_QUERY_VALUE_PARAM}" or saftTopicalTerm all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
[SearchableIndex.ChildrenSubjectHeading]: { | ||
query: `((keyword all "${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}") and subjectHeadings=="b")`, | ||
[SearchableIndexQuerySelector.Query]: `((keyword all "${SEARCH_QUERY_VALUE_PARAM}" or naturalId="${SEARCH_QUERY_VALUE_PARAM}") and subjectHeadings=="b")`, | ||
}, | ||
[SearchableIndex.Genre]: { | ||
query: `(genreTerm all "${SEARCH_QUERY_VALUE_PARAM}" or sftGenreTerm all "${SEARCH_QUERY_VALUE_PARAM}" or saftGenreTerm all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
[SearchableIndexQuerySelector.Query]: `(genreTerm all "${SEARCH_QUERY_VALUE_PARAM}" or sftGenreTerm all "${SEARCH_QUERY_VALUE_PARAM}" or saftGenreTerm all "${SEARCH_QUERY_VALUE_PARAM}")`, | ||
}, | ||
}, | ||
// TODO: dynamically generate browse queries | ||
[SearchSegment.Browse]: { | ||
[SearchableIndex.PersonalName]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Personal Name")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Personal Name")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Personal Name")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Personal Name")`, | ||
}, | ||
[SearchableIndex.CorporateConferenceName]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Conference Name" or "Corporate Name")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Conference Name" or "Corporate Name")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Conference Name" or "Corporate Name")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Conference Name" or "Corporate Name")`, | ||
}, | ||
[SearchableIndex.GeographicName]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Geographic Name")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Geographic Name")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Geographic Name")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Geographic Name")`, | ||
}, | ||
[SearchableIndex.NameTitle]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==true and headingType==("Conference Name" or "Corporate Name" or "Personal Name")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==true and headingType==("Conference Name" or "Corporate Name" or "Personal Name")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==true and headingType==("Conference Name" or "Corporate Name" or "Personal Name")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==true and headingType==("Conference Name" or "Corporate Name" or "Personal Name")`, | ||
}, | ||
[SearchableIndex.UniformTitle]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Uniform Title")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Uniform Title")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Uniform Title")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Uniform Title")`, | ||
}, | ||
[SearchableIndex.Subject]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Topical")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Topical")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Topical")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Topical")`, | ||
}, | ||
[SearchableIndex.Genre]: { | ||
query: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Genre")`, | ||
[SearchableIndexQuerySelector.Query]: `(headingRef>="${SEARCH_QUERY_VALUE_PARAM}" or headingRef<"${SEARCH_QUERY_VALUE_PARAM}") and isTitleHeadingRef==false and headingType==("Genre")`, | ||
[SearchableIndexQuerySelector.Prev]: `headingRef<"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Genre")`, | ||
[SearchableIndexQuerySelector.Next]: `headingRef>"${SEARCH_QUERY_VALUE_PARAM}" and isTitleHeadingRef==false and headingType==("Genre")`, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters