1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

switch to queryMetadataByText

This commit is contained in:
Matthias Kretschmann 2019-04-03 12:22:33 +02:00
parent 876ee28203
commit 82eba1750b
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -18,23 +18,27 @@ interface SearchProps {
}
export default class Search extends Component<SearchProps, SearchState> {
public state = { results: [], isLoading: true }
public state = { results: [], isLoading: true, page: 0 }
public async componentDidMount() {
const searchParams = queryString.parse(this.props.location.search)
const { text } = searchParams
const queryRequest = {
offset: 500,
page: 1,
const searchQuery = {
text,
offset: 100,
page: 0,
query: {
text: searchParams.text
value: 1
},
sort: {
text: 1
datePublished: 1
}
}
const assets = await this.context.ocean.assets.search(searchParams.text)
const assets = await this.context.ocean.aquarius.queryMetadataByText(
searchQuery
)
this.setState({ results: assets, isLoading: false })
Logger.log(`Loaded ${assets.length} assets`)
}
@ -49,7 +53,7 @@ export default class Search extends Component<SearchProps, SearchState> {
))}
</div>
) : (
<div>No data sets yet</div>
<div>No data sets found.</div>
)
public render() {