Use AND instead of OR for tags search // Sort tags when displayed (#2719)
This commit is contained in:
parent
57f33c45cc
commit
88eb72468e
@ -38,7 +38,9 @@ export default class Tags extends Component {
|
|||||||
? [ styles.tag, styles.tagClickable ]
|
? [ styles.tag, styles.tagClickable ]
|
||||||
: [ styles.tag ];
|
: [ styles.tag ];
|
||||||
|
|
||||||
return tags.map((tag, idx) => {
|
return tags
|
||||||
|
.sort()
|
||||||
|
.map((tag, idx) => {
|
||||||
const onClick = handleAddSearchToken
|
const onClick = handleAddSearchToken
|
||||||
? () => handleAddSearchToken(tag)
|
? () => handleAddSearchToken(tag)
|
||||||
: null;
|
: null;
|
||||||
|
@ -130,15 +130,15 @@ export default class List extends Component {
|
|||||||
.concat(tags, name)
|
.concat(tags, name)
|
||||||
.map(v => v.toLowerCase());
|
.map(v => v.toLowerCase());
|
||||||
|
|
||||||
return values
|
|
||||||
.filter((value) => {
|
|
||||||
return searchValues
|
return searchValues
|
||||||
.map(searchValue => value.indexOf(searchValue) >= 0)
|
.map(searchValue => {
|
||||||
|
return values
|
||||||
|
.filter(value => value.indexOf(searchValue) >= 0)
|
||||||
|
.length > 0;
|
||||||
|
})
|
||||||
// `current && truth, true` => use tokens as AND
|
// `current && truth, true` => use tokens as AND
|
||||||
// `current || truth, false` => use tokens as OR
|
// `current || truth, false` => use tokens as OR
|
||||||
.reduce((current, truth) => current || truth, false);
|
.reduce((current, truth) => current && truth, true);
|
||||||
})
|
|
||||||
.length > 0;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user