summaryrefslogtreecommitdiff
path: root/client/components/results.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-04-28 17:22:41 +0200
committerJules Laplace <julescarbon@gmail.com>2019-04-28 17:22:41 +0200
commit87cab42c2a4bf1c481e0ef1589e479ea82c0520f (patch)
treee42218512390c36d5e74c019cac8b1dce4f1f57e /client/components/results.component.js
parentd349e62cf53eda4b1a6b3cdc75ae9302dc2d4d5d (diff)
more exact threshold for more exact matches
Diffstat (limited to 'client/components/results.component.js')
-rw-r--r--client/components/results.component.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/client/components/results.component.js b/client/components/results.component.js
index ac028d2..3248a9a 100644
--- a/client/components/results.component.js
+++ b/client/components/results.component.js
@@ -5,7 +5,8 @@ import { connect } from 'react-redux'
import * as actions from '../actions'
import * as types from '../types'
-function Results({ actions, loading, success, error, match, results, added }) {
+function Results({ actions, query, similar }) {
+ const { loading, success, error, match, results, added } = similar
if (!success && !error) {
return (
<div className='results'>
@@ -21,7 +22,6 @@ function Results({ actions, loading, success, error, match, results, added }) {
}
if (error) {
- console.log(error)
return (
<div className='results'>
<b>Error: {typeof error == 'string' ? error.replace(/_/g, ' ') : 'Server error'}</b>
@@ -52,14 +52,13 @@ function Results({ actions, loading, success, error, match, results, added }) {
if (searchURL.indexOf('http') !== 0) {
searchURL = window.location.origin + searchURL
}
- actions.similar(searchURL, types.SIMILAR_THRESHOLD)
+ actions.similar(searchURL, query.threshold)
actions.updateQuery({
image: url,
blob: null,
searchType: 'url',
thresholdChanged: false,
saveIfNotFound: false,
- threshold: types.SIMILAR_THRESHOLD,
})
}}
/>
@@ -77,7 +76,7 @@ function Results({ actions, loading, success, error, match, results, added }) {
)
}
-const mapStateToProps = state => (state.api.similar || {})
+const mapStateToProps = state => state.api
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators({ ...actions }, dispatch),
})