Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/api/scenes.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,12 @@ func (i SceneResource) searchSceneIndex(req *restful.Request, resp *restful.Resp
}

defer idx.Bleve.Close()
query := bleve.NewQueryStringQuery(q)
// The index analyzer splits on apostrophes ("Sister's" -> "sister", "s"), so a query
// keeping the apostrophe ("Sister's") or dropping it ("Sisters") never lines up with
// the indexed terms. Normalising apostrophes to spaces ("Sister s") matches how titles
// are tokenised, which is what filename-derived match queries need.
bleveQuery := strings.NewReplacer("'", " ", "’", " ", "`", " ").Replace(q)
query := bleve.NewQueryStringQuery(bleveQuery)

searchRequest := bleve.NewSearchRequest(query)
searchRequest.Fields = []string{"Id", "title", "cast", "site", "description"}
Expand Down
5 changes: 2 additions & 3 deletions ui/src/views/files/SceneMatch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ export default {
this.data = []
this.queryString = (
this.file.filename
.replace(/\.|_|\+|-/g, ' ').replace(/\s+/g, ' ').trim()
.split(' ').filter(isNotCommonWord).join(' ')
.replace(/ s /g, '\'s '))
.replace(/[._+'’`-]/g, ' ').replace(/\s+/g, ' ').trim()
.split(' ').filter(isNotCommonWord).join(' '))
this.loadData()
},
loadData: async function loadData () {
Expand Down