Add emoticons to search index
parent
573ef818f5
commit
9e57de33ce
|
@ -14,6 +14,7 @@ export default class Search extends React.Component {
|
|||
this.pipeline.reset()
|
||||
|
||||
this.field('short_name', { boost: 2 })
|
||||
this.field('emoticons')
|
||||
this.field('name')
|
||||
|
||||
this.ref('id')
|
||||
|
@ -21,10 +22,16 @@ export default class Search extends React.Component {
|
|||
|
||||
for (let emoji in data.emojis) {
|
||||
let emojiData = data.emojis[emoji],
|
||||
{ short_name, name } = emojiData
|
||||
{ short_name, name, text, texts } = emojiData
|
||||
|
||||
texts || (texts = [])
|
||||
if (text && !texts.length) {
|
||||
texts = [text]
|
||||
}
|
||||
|
||||
this.index.add({
|
||||
id: short_name,
|
||||
emoticons: texts,
|
||||
short_name: this.tokenize(short_name),
|
||||
name: this.tokenize(name),
|
||||
})
|
||||
|
@ -36,6 +43,10 @@ export default class Search extends React.Component {
|
|||
return string.split('')
|
||||
}
|
||||
|
||||
if (/(:|;|=)-/.test(string)) {
|
||||
return [string]
|
||||
}
|
||||
|
||||
return string.split(/[-|_|\s]+/)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue