1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Update search and publish (#444)

* fix querys

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* lib bump, publish update

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* package-lock

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* fix searchquery

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2021-03-18 13:27:58 +02:00 committed by GitHub
parent bdccb0966f
commit 1599d74cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 18 deletions

View File

@ -121,7 +121,6 @@ const queryLatest = {
page: 1,
offset: 9,
query: {
nativeSearch: 1,
// https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
query_string: { query: `-isInPurgatory:true` }
},

8
package-lock.json generated
View File

@ -3625,9 +3625,9 @@
"integrity": "sha512-6GrBk1jy+zxjDjh2SPra06etrqdp8CB6RaZaTq2OQpK8dA2Dq91hqCbj+6eb21MlU8bDY3/atnxax9rgPgsxkA=="
},
"@oceanprotocol/lib": {
"version": "0.11.4",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.11.4.tgz",
"integrity": "sha512-sYfbgsOmiF6RrSjeGCvKEXoLl2Q41wKuoWT5gAqy7IoyVjwDerx96kLdTZp33etMoQ0/MJRud0ZGL0sZwqfVWw==",
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.12.0.tgz",
"integrity": "sha512-bREJhiyQ1LlFdLY0WoZbelfH27R7PLi0pY+c3TiX3fYvDShfp5NCYkq0B8Wf4FjxUxd4BMJREwRNdOS416RYVA==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.2",
"@oceanprotocol/contracts": "^0.5.10",
@ -16410,7 +16410,7 @@
}
},
"ethereumjs-abi": {
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1a27c59c15ab1e95ee8e5c4ed6ad814c49cc439e",
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1ce6a1d64235fabe2aaf827fd606def55693508f",
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
"requires": {
"bn.js": "^4.11.8",

View File

@ -27,7 +27,7 @@
"@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "^5.14.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.11.4",
"@oceanprotocol/lib": "^0.12.0",
"@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^3.0.3",
"@sindresorhus/slugify": "^1.0.0",

View File

@ -26,7 +26,6 @@ async function getAssetsBookmarked(
page: 1,
offset: 100,
query: {
nativeSearch: 1,
query_string: {
query: searchDids,
fields: ['dataToken'],
@ -34,7 +33,7 @@ async function getAssetsBookmarked(
}
},
sort: { created: -1 }
} as any
}
try {
const result = await queryMetadata(

View File

@ -25,7 +25,6 @@ export default function PublishedList(): ReactElement {
page: page,
offset: 9,
query: {
nativeSearch: 1,
query_string: {
query: `(publicKey.owner:${accountId})`
}
@ -35,7 +34,7 @@ export default function PublishedList(): ReactElement {
try {
queryResult || setIsLoading(true)
const result = await queryMetadata(
queryPublishedAssets as any,
queryPublishedAssets,
config.metadataCacheUri,
source.token
)

View File

@ -2,7 +2,10 @@ import React, { ReactElement, useEffect, useState } from 'react'
import SearchBar from '../molecules/SearchBar'
import styles from './Home.module.css'
import AssetList from '../organisms/AssetList'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import {
QueryResult,
SearchQuery
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import Container from '../atoms/Container'
import Loader from '../atoms/Loader'
import { useOcean } from '../../providers/Ocean'
@ -15,7 +18,6 @@ const queryHighest = {
page: 1,
offset: 9,
query: {
nativeSearch: 1,
query_string: {
query: `(price.type:pool) -isInPurgatory:true`
}
@ -27,7 +29,6 @@ const queryLatest = {
page: 1,
offset: 9,
query: {
nativeSearch: 1,
query_string: {
query: `-isInPurgatory:true`
}
@ -49,7 +50,7 @@ function SectionQueryResult({
action
}: {
title: ReactElement | string
query: any
query: SearchQuery
action?: ReactElement
}) {
const { config } = useOcean()
@ -62,9 +63,8 @@ function SectionQueryResult({
const source = axios.CancelToken.source()
async function init() {
// TODO: remove any once ocean.js has nativeSearch typings
const result = await queryMetadata(
query as any,
query,
config.metadataCacheUri,
source.token
)

View File

@ -78,7 +78,6 @@ export function getSearchQuery(
page: Number(page) || 1,
offset: Number(offset) || 21,
query: {
nativeSearch: 1,
query_string: {
query: `${searchTerm} -isInPurgatory:true`
}
@ -98,7 +97,7 @@ export function getSearchQuery(
// And the next hack,
// nativeSearch is not implmeneted on ocean.js typings
} as any
}
}
export async function getResults(

View File

@ -145,6 +145,8 @@ function usePublish(): UsePublish {
providerUri
)
.next(setStep)
await ocean.assets.publishDdo(ddo, account.getId())
Logger.log('ddo created', ddo)
await sleep(20000)
setStep(7)