diff options
Diffstat (limited to 'internal/index')
-rw-r--r-- | internal/index/index_meta.go | 9 | ||||
-rw-r--r-- | internal/index/indexer.go | 1 | ||||
-rw-r--r-- | internal/index/search.go | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/internal/index/index_meta.go b/internal/index/index_meta.go index e67c6f2..7d133cd 100644 --- a/internal/index/index_meta.go +++ b/internal/index/index_meta.go @@ -11,12 +11,13 @@ import ( "github.com/pkg/errors" ) -const CurrentSchemaVersion = 2 +const CurrentSchemaVersion = 3 type SourceMeta struct { - Updated time.Time - Path string - Rev string + Updated time.Time + Path string + Rev string + ProgramsPath string } type data struct { diff --git a/internal/index/indexer.go b/internal/index/indexer.go index 0c12104..9c291b8 100644 --- a/internal/index/indexer.go +++ b/internal/index/indexer.go @@ -126,6 +126,7 @@ func createIndexMapping() (mapping.IndexMapping, error) { packageMapping.AddFieldMappingsAt("MainProgram", keywordFieldMapping) packageMapping.AddFieldMappingsAt("PackageSet", keywordFieldMapping) packageMapping.AddFieldMappingsAt("Platforms", keywordFieldMapping) + packageMapping.AddFieldMappingsAt("Programs", keywordFieldMapping) indexMapping.AddDocumentMapping("option", optionMapping) indexMapping.AddDocumentMapping("package", packageMapping) diff --git a/internal/index/search.go b/internal/index/search.go index 9d77488..a62f484 100644 --- a/internal/index/search.go +++ b/internal/index/search.go @@ -164,6 +164,11 @@ func (index *ReadIndex) Search( query.AddShould(q) } + programsQuery := bleve.NewMatchQuery(keyword) + programsQuery.SetField("Programs") + programsQuery.Analyzer = "keyword_single" + query.AddShould(programsQuery) + attrQuery := bleve.NewMatchQuery(keyword) attrQuery.SetField("Attribute") attrQuery.Analyzer = "keyword_single" |