mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Search: Filter punctuation and tokenize camel case (#51165)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
@@ -9,9 +9,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/blugelabs/bluge"
|
||||
"github.com/blugelabs/bluge/analysis"
|
||||
"github.com/blugelabs/bluge/analysis/token"
|
||||
"github.com/blugelabs/bluge/analysis/tokenizer"
|
||||
"github.com/blugelabs/bluge/search"
|
||||
"github.com/blugelabs/bluge/search/aggregations"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@@ -218,23 +215,6 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
|
||||
return docs
|
||||
}
|
||||
|
||||
const ngramEdgeFilterMaxLength = 7
|
||||
|
||||
var ngramIndexAnalyzer = &analysis.Analyzer{
|
||||
Tokenizer: tokenizer.NewWhitespaceTokenizer(),
|
||||
TokenFilters: []analysis.TokenFilter{
|
||||
token.NewLowerCaseFilter(),
|
||||
token.NewEdgeNgramFilter(token.FRONT, 1, ngramEdgeFilterMaxLength),
|
||||
},
|
||||
}
|
||||
|
||||
var ngramQueryAnalyzer = &analysis.Analyzer{
|
||||
Tokenizer: tokenizer.NewWhitespaceTokenizer(),
|
||||
TokenFilters: []analysis.TokenFilter{
|
||||
token.NewLowerCaseFilter(),
|
||||
},
|
||||
}
|
||||
|
||||
// Names need to be indexed a few ways to support key features
|
||||
func newSearchDocument(uid string, name string, descr string, url string) *bluge.Document {
|
||||
doc := bluge.NewDocument(uid)
|
||||
@@ -419,10 +399,11 @@ func doSearchQuery(
|
||||
} else {
|
||||
// The actual se
|
||||
bq := bluge.NewBooleanQuery().
|
||||
AddShould(bluge.NewMatchPhraseQuery(q.Query).SetField(documentFieldName).SetBoost(6)).
|
||||
AddShould(bluge.NewMatchPhraseQuery(q.Query).SetField(documentFieldDescription).SetBoost(3)).
|
||||
AddShould(bluge.NewMatchQuery(q.Query).SetField(documentFieldName).SetBoost(6)).
|
||||
AddShould(bluge.NewMatchQuery(q.Query).SetField(documentFieldDescription).SetBoost(3)).
|
||||
AddShould(bluge.NewMatchQuery(q.Query).
|
||||
SetField(documentFieldName_ngram).
|
||||
SetOperator(bluge.MatchQueryOperatorAnd). // all terms must match
|
||||
SetAnalyzer(ngramQueryAnalyzer).SetBoost(1))
|
||||
|
||||
if len(q.Query) > 4 {
|
||||
|
||||
@@ -250,14 +250,14 @@ var testPrefixDashboards = []dashboard{
|
||||
id: 1,
|
||||
uid: "1",
|
||||
info: &extract.DashboardInfo{
|
||||
Title: "Archer Data",
|
||||
Title: "Archer Data System",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
uid: "2",
|
||||
info: &extract.DashboardInfo{
|
||||
Title: "Document Sync",
|
||||
Title: "Document Sync repo",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -303,21 +303,22 @@ func TestDashboardIndex_MultipleTokensInRow(t *testing.T) {
|
||||
t.Run("multiple-tokens-beginning-lower", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, testPrefixDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "archer da"},
|
||||
DashboardQuery{Query: "da archer"},
|
||||
)
|
||||
})
|
||||
|
||||
// Not sure it is great this matches, but
|
||||
t.Run("multiple-tokens-middle", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, testPrefixDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "rcher Da"},
|
||||
DashboardQuery{Query: "ar Da"},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("multiple-tokens-middle-lower", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, testPrefixDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "cument sy"},
|
||||
DashboardQuery{Query: "doc sy"},
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -511,3 +512,55 @@ func TestDashboardIndex_Panels(t *testing.T) {
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
var punctuationSplitNgramDashboards = []dashboard{
|
||||
{
|
||||
id: 1,
|
||||
uid: "1",
|
||||
info: &extract.DashboardInfo{
|
||||
Title: "heat-torkel",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
uid: "2",
|
||||
info: &extract.DashboardInfo{
|
||||
Title: "topology heatmap",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestDashboardIndex_PunctuationNgram(t *testing.T) {
|
||||
t.Run("ngram-punctuation-split", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, punctuationSplitNgramDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "tork he"},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("ngram-simple", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, punctuationSplitNgramDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "hea"},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
var camelCaseNgramDashboards = []dashboard{
|
||||
{
|
||||
id: 1,
|
||||
uid: "1",
|
||||
info: &extract.DashboardInfo{
|
||||
Title: "heatTorkel",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestDashboardIndex_CamelCaseNgram(t *testing.T) {
|
||||
t.Run("ngram-camel-case-split", func(t *testing.T) {
|
||||
_, reader, _ := initTestIndexFromDashes(t, camelCaseNgramDashboards)
|
||||
checkSearchResponse(t, filepath.Base(t.Name()), reader, testAllowAllFilter,
|
||||
DashboardQuery{Query: "tork"},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
47
pkg/services/searchV2/ngram.go
Normal file
47
pkg/services/searchV2/ngram.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package searchV2
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/blugelabs/bluge/analysis"
|
||||
"github.com/blugelabs/bluge/analysis/token"
|
||||
"github.com/blugelabs/bluge/analysis/tokenizer"
|
||||
)
|
||||
|
||||
var punctuationReplacer *strings.Replacer
|
||||
|
||||
func init() {
|
||||
var punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
||||
args := make([]string, 0, len(punctuation)*2)
|
||||
for _, r := range punctuation {
|
||||
args = append(args, string(r), " ")
|
||||
}
|
||||
punctuationReplacer = strings.NewReplacer(args...)
|
||||
}
|
||||
|
||||
type punctuationCharFilter struct{}
|
||||
|
||||
func (t *punctuationCharFilter) Filter(input []byte) []byte {
|
||||
return []byte(punctuationReplacer.Replace(string(input)))
|
||||
}
|
||||
|
||||
const ngramEdgeFilterMaxLength = 7
|
||||
|
||||
var ngramIndexAnalyzer = &analysis.Analyzer{
|
||||
CharFilters: []analysis.CharFilter{&punctuationCharFilter{}},
|
||||
Tokenizer: tokenizer.NewWhitespaceTokenizer(),
|
||||
TokenFilters: []analysis.TokenFilter{
|
||||
token.NewCamelCaseFilter(),
|
||||
token.NewLowerCaseFilter(),
|
||||
token.NewEdgeNgramFilter(token.FRONT, 1, ngramEdgeFilterMaxLength),
|
||||
},
|
||||
}
|
||||
|
||||
var ngramQueryAnalyzer = &analysis.Analyzer{
|
||||
CharFilters: []analysis.CharFilter{&punctuationCharFilter{}},
|
||||
Tokenizer: tokenizer.NewWhitespaceTokenizer(),
|
||||
TokenFilters: []analysis.TokenFilter{
|
||||
token.NewCamelCaseFilter(),
|
||||
token.NewLowerCaseFilter(),
|
||||
},
|
||||
}
|
||||
59
pkg/services/searchV2/ngram_test.go
Normal file
59
pkg/services/searchV2/ngram_test.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package searchV2
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_punctuationCharFilter_Filter(t1 *testing.T) {
|
||||
type args struct {
|
||||
input []byte
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want []byte
|
||||
}{
|
||||
{
|
||||
name: "1",
|
||||
args: args{
|
||||
input: []byte("x-Rays"),
|
||||
},
|
||||
want: []byte("x Rays"),
|
||||
},
|
||||
{
|
||||
name: "2",
|
||||
args: args{
|
||||
input: []byte("x.Rays"),
|
||||
},
|
||||
want: []byte("x Rays"),
|
||||
},
|
||||
{
|
||||
name: "3",
|
||||
args: args{
|
||||
input: []byte("[x,Rays]"),
|
||||
},
|
||||
want: []byte(" x Rays "),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t1.Run(tt.name, func(t1 *testing.T) {
|
||||
t := &punctuationCharFilter{}
|
||||
if got := t.Filter(tt.args.input); !reflect.DeepEqual(got, tt.want) {
|
||||
t1.Errorf("Filter() = %v, want %v", string(got), string(tt.want))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNgramIndexAnalyzer(t *testing.T) {
|
||||
stream := ngramIndexAnalyzer.Analyze([]byte("x-rays.and.xRays, and НемногоКириллицы"))
|
||||
expectedTerms := []string{"x", "r", "ra", "ray", "rays", "a", "an", "and", "x", "r", "ra", "ray", "rays", "a", "an", "and", "н", "не", "нем", "немн", "немно", "немног", "немного", "к", "ки", "кир", "кири", "кирил", "кирилл", "кирилли"}
|
||||
var actualTerms []string
|
||||
for _, t := range stream {
|
||||
actualTerms = append(actualTerms, string(t.Term))
|
||||
}
|
||||
require.Equal(t, expectedTerms, actualTerms)
|
||||
}
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data System | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"Archer Data"
|
||||
"Archer Data System"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data System | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"Archer Data"
|
||||
"Archer Data System"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync repo | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"2"
|
||||
],
|
||||
[
|
||||
"Document Sync"
|
||||
"Document Sync repo"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data System | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"Archer Data"
|
||||
"Archer Data System"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
131
pkg/services/searchV2/testdata/ngram-camel-case-split.jsonc
vendored
Normal file
131
pkg/services/searchV2/testdata/ngram-camel-case-split.jsonc
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "search-results",
|
||||
// "custom": {
|
||||
// "count": 1
|
||||
// }
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | heatTorkel | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"name": "Query results",
|
||||
"meta": {
|
||||
"type": "search-results",
|
||||
"custom": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "kind",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "uid",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "panel_type",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
},
|
||||
"config": {
|
||||
"links": [
|
||||
{
|
||||
"title": "link",
|
||||
"url": "${__value.text}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ds_uid",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
"dashboard"
|
||||
],
|
||||
[
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"heatTorkel"
|
||||
],
|
||||
[
|
||||
""
|
||||
],
|
||||
[
|
||||
"/pfix/d/1/"
|
||||
],
|
||||
[
|
||||
null
|
||||
],
|
||||
[
|
||||
null
|
||||
],
|
||||
[
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
131
pkg/services/searchV2/testdata/ngram-punctuation-split.jsonc
vendored
Normal file
131
pkg/services/searchV2/testdata/ngram-punctuation-split.jsonc
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "search-results",
|
||||
// "custom": {
|
||||
// "count": 1
|
||||
// }
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | heat-torkel | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"name": "Query results",
|
||||
"meta": {
|
||||
"type": "search-results",
|
||||
"custom": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "kind",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "uid",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "panel_type",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
},
|
||||
"config": {
|
||||
"links": [
|
||||
{
|
||||
"title": "link",
|
||||
"url": "${__value.text}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ds_uid",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
"dashboard"
|
||||
],
|
||||
[
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"heat-torkel"
|
||||
],
|
||||
[
|
||||
""
|
||||
],
|
||||
[
|
||||
"/pfix/d/1/"
|
||||
],
|
||||
[
|
||||
null
|
||||
],
|
||||
[
|
||||
null
|
||||
],
|
||||
[
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
140
pkg/services/searchV2/testdata/ngram-simple.jsonc
vendored
Normal file
140
pkg/services/searchV2/testdata/ngram-simple.jsonc
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "search-results",
|
||||
// "custom": {
|
||||
// "count": 2
|
||||
// }
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 2 Rows
|
||||
// +----------------+----------------+------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | heat-torkel | | /pfix/d/1/ | null | null | |
|
||||
// | dashboard | 2 | topology heatmap | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"name": "Query results",
|
||||
"meta": {
|
||||
"type": "search-results",
|
||||
"custom": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "kind",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "uid",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "panel_type",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
},
|
||||
"config": {
|
||||
"links": [
|
||||
{
|
||||
"title": "link",
|
||||
"url": "${__value.text}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ds_uid",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
"dashboard",
|
||||
"dashboard"
|
||||
],
|
||||
[
|
||||
"1",
|
||||
"2"
|
||||
],
|
||||
[
|
||||
"heat-torkel",
|
||||
"topology heatmap"
|
||||
],
|
||||
[
|
||||
"",
|
||||
""
|
||||
],
|
||||
[
|
||||
"/pfix/d/1/",
|
||||
"/pfix/d/2/"
|
||||
],
|
||||
[
|
||||
null,
|
||||
null
|
||||
],
|
||||
[
|
||||
null,
|
||||
null
|
||||
],
|
||||
[
|
||||
"",
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data System | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"Archer Data"
|
||||
"Archer Data System"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 1 | Archer Data System | | /pfix/d/1/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"Archer Data"
|
||||
"Archer Data System"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync repo | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"2"
|
||||
],
|
||||
[
|
||||
"Document Sync"
|
||||
"Document Sync repo"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// }
|
||||
// Name: Query results
|
||||
// Dimensions: 8 Fields by 1 Rows
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+----------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | Name: kind | Name: uid | Name: name | Name: panel_type | Name: url | Name: tags | Name: ds_uid | Name: location |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []string |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
// | dashboard | 2 | Document Sync repo | | /pfix/d/2/ | null | null | |
|
||||
// +----------------+----------------+--------------------+------------------+----------------+--------------------------+--------------------------+----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
@@ -107,7 +107,7 @@
|
||||
"2"
|
||||
],
|
||||
[
|
||||
"Document Sync"
|
||||
"Document Sync repo"
|
||||
],
|
||||
[
|
||||
""
|
||||
|
||||
Reference in New Issue
Block a user