diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-28 17:22:41 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-28 17:22:41 +0200 |
| commit | 87cab42c2a4bf1c481e0ef1589e479ea82c0520f (patch) | |
| tree | e42218512390c36d5e74c019cac8b1dce4f1f57e | |
| parent | d349e62cf53eda4b1a6b3cdc75ae9302dc2d4d5d (diff) | |
more exact threshold for more exact matches
| -rw-r--r-- | check/app/server/api.py | 2 | ||||
| -rw-r--r-- | client/components/results.component.js | 9 | ||||
| -rw-r--r-- | client/store.js | 4 | ||||
| -rw-r--r-- | client/types.js | 2 |
4 files changed, 7 insertions, 10 deletions
diff --git a/check/app/server/api.py b/check/app/server/api.py index f007314..324a63a 100644 --- a/check/app/server/api.py +++ b/check/app/server/api.py @@ -15,7 +15,7 @@ from app.utils.file_utils import sha256_stream sanitize_re = re.compile('[\W]+') valid_exts = ['.gif', '.jpg', '.jpeg', '.png'] -MATCH_THRESHOLD = 6 +MATCH_THRESHOLD = 1 MATCH_LIMIT = 1 SIMILAR_THRESHOLD = 20 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 |
