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:
parent
876ee28203
commit
82eba1750b
@ -18,23 +18,27 @@ interface SearchProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class Search extends Component<SearchProps, SearchState> {
|
export default class Search extends Component<SearchProps, SearchState> {
|
||||||
public state = { results: [], isLoading: true }
|
public state = { results: [], isLoading: true, page: 0 }
|
||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
const searchParams = queryString.parse(this.props.location.search)
|
const searchParams = queryString.parse(this.props.location.search)
|
||||||
|
const { text } = searchParams
|
||||||
|
|
||||||
const queryRequest = {
|
const searchQuery = {
|
||||||
offset: 500,
|
text,
|
||||||
page: 1,
|
offset: 100,
|
||||||
|
page: 0,
|
||||||
query: {
|
query: {
|
||||||
text: searchParams.text
|
value: 1
|
||||||
},
|
},
|
||||||
sort: {
|
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 })
|
this.setState({ results: assets, isLoading: false })
|
||||||
Logger.log(`Loaded ${assets.length} assets`)
|
Logger.log(`Loaded ${assets.length} assets`)
|
||||||
}
|
}
|
||||||
@ -49,7 +53,7 @@ export default class Search extends Component<SearchProps, SearchState> {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>No data sets yet</div>
|
<div>No data sets found.</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user