mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Fix compute dataset algorithm list (#1194)
* fix query Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * remove comment Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
parent
2ef29d905e
commit
8aa6b3997a
@ -11,6 +11,12 @@ import { transformAssetToAssetSelection } from './assetConvertor'
|
||||
|
||||
export const MAXIMUM_NUMBER_OF_PAGES_WITH_RESULTS = 476
|
||||
|
||||
export function escapeEsReservedCharacters(value: string): string {
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
const pattern = /([\!\*\+\-\=\<\>\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g
|
||||
return value.replace(pattern, '\\$1')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filterField the name of the actual field from the ddo schema e.g. 'id','service.attributes.main.type'
|
||||
* @param value the value of the filter
|
||||
@ -227,12 +233,15 @@ export async function getAlgorithmDatasetsForCompute(
|
||||
): Promise<AssetSelectionAsset[]> {
|
||||
const baseQueryParams = {
|
||||
chainIds: [datasetChainId],
|
||||
filters: [
|
||||
getFilterTerm(
|
||||
'service.compite.publisherTrustedAlgorithms.did',
|
||||
algorithmId
|
||||
)
|
||||
],
|
||||
nestedQuery: {
|
||||
must: {
|
||||
match: {
|
||||
'services.compute.publisherTrustedAlgorithms.did': {
|
||||
query: escapeEsReservedCharacters(algorithmId)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sortOptions: {
|
||||
sortBy: SortTermOptions.Created,
|
||||
sortDirection: SortDirectionOptions.Descending
|
||||
|
Loading…
x
Reference in New Issue
Block a user