Better query fuzziness
This commit is contained in:
parent
a5776c596e
commit
e586067521
|
@ -71,6 +71,10 @@ const REQUESTS = {
|
|||
WAIT: 10000 // 10 seconds
|
||||
}
|
||||
|
||||
const ELASTIC_SEARCH_QUERY = {
|
||||
FUZZINESS: 'AUTO:4,7'
|
||||
}
|
||||
|
||||
function getWebserverUrl () {
|
||||
if (CONFIG.WEBSERVER.PORT === 80 || CONFIG.WEBSERVER.PORT === 443) {
|
||||
return CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME
|
||||
|
@ -94,5 +98,6 @@ export {
|
|||
SCHEDULER_INTERVALS_MS,
|
||||
INDEXER_CONCURRENCY,
|
||||
INDEXER_COUNT,
|
||||
REQUESTS
|
||||
REQUESTS,
|
||||
ELASTIC_SEARCH_QUERY
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { difference } from 'lodash'
|
||||
|
||||
import { buildIndex, buildSort, elasticSearch, extractQueryResult, indexDocuments } from '../helpers/elastic-search'
|
||||
import { logger } from '../helpers/logger'
|
||||
import { CONFIG } from '../initializers/constants'
|
||||
import { CONFIG, ELASTIC_SEARCH_QUERY } from '../initializers/constants'
|
||||
import { ChannelsSearchQuery } from '../types/channel-search.model'
|
||||
import { DBChannel, EnhancedVideoChannel, IndexableChannel } from '../types/channel.model'
|
||||
import { buildAvatarMapping, formatAvatarForAPI, formatAvatarForDB } from './elastic-search-avatar'
|
||||
|
@ -86,7 +85,7 @@ async function queryChannels (search: ChannelsSearchQuery) {
|
|||
multi_match: {
|
||||
query: search.search,
|
||||
fields: [ 'name^5', 'displayName^3', 'description' ],
|
||||
fuzziness: 'AUTO'
|
||||
fuzziness: ELASTIC_SEARCH_QUERY.FUZZINESS
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@ import { difference } from 'lodash'
|
|||
import { buildIndex, buildSort, elasticSearch, extractQueryResult, indexDocuments } from '../helpers/elastic-search'
|
||||
import { logger } from '../helpers/logger'
|
||||
import { buildUrl } from '../helpers/utils'
|
||||
import { CONFIG } from '../initializers/constants'
|
||||
import { CONFIG, ELASTIC_SEARCH_QUERY } from '../initializers/constants'
|
||||
import { VideosSearchQuery } from '../types/video-search.model'
|
||||
import { DBVideo, DBVideoDetails, EnhancedVideo, IndexableVideo, IndexableVideoDetails } from '../types/video.model'
|
||||
import { buildAvatarMapping, formatAvatarForAPI, formatAvatarForDB } from './elastic-search-avatar'
|
||||
|
@ -117,7 +117,7 @@ async function queryVideos (search: VideosSearchQuery) {
|
|||
multi_match: {
|
||||
query: search.search,
|
||||
fields: [ 'name^5', 'description', 'tags^3' ],
|
||||
fuzziness: 'AUTO'
|
||||
fuzziness: ELASTIC_SEARCH_QUERY.FUZZINESS
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue