summaryrefslogtreecommitdiff
path: root/client
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
parentd349e62cf53eda4b1a6b3cdc75ae9302dc2d4d5d (diff)
more exact threshold for more exact matches
Diffstat (limited to 'client')
-rw-r--r--client/components/results.component.js9
-rw-r--r--client/store.js4
-rw-r--r--client/types.js2
3 files changed, 6 insertions, 9 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),
})
diff --git a/client/store.js b/client/store.js
index 802a47b..32895cb 100644
--- a/client/store.js
+++ b/client/store.js
@@ -14,9 +14,7 @@ const initialState = () => ({
thresholdChanged: false,
saveIfNotFound: false,
},
- api: {
- similar: {}
- },
+ similar: {},
})
export default function apiReducer(state = initialState(), action) {
diff --git a/client/types.js b/client/types.js
index 9a66973..4e75fcb 100644
--- a/client/types.js
+++ b/client/types.js
@@ -15,5 +15,5 @@ export const system = tagAsType('system', [
export const init = '@@INIT'
-export const MATCH_THRESHOLD = 6
+export const MATCH_THRESHOLD = 1
export const SIMILAR_THRESHOLD = 20