From 34399cfd7a618198822ddb2d0052adc39e5568e4 Mon Sep 17 00:00:00 2001 From: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Date: Sun, 12 Feb 2023 18:09:03 +0800 Subject: [PATCH 1/2] Make issue and code search support camel case (#22829) Fixes #22714 ### Changes: 1. Add a token filter which named "camelCase" between custom unicode token filter and "to_lower" token filter when add custom analyzer. ### Notice: If users want this feature to work, they should delete folder under {giteaPath}/data/indexers and restart application. Then application will create a new IndexMapping. ### Screenshots: ![image](https://user-images.githubusercontent.com/33891828/217715692-c18c41f2-57a1-4727-861c-470935c8e0c8.png) ### Others: I originally attempted to give users the ability to configure the "token_filters" in the "app.ini" file. But I found that if users does not strictly follow a right order to register "token_filters", they won't get the expected results. I think it is difficult to ask users to do this. So I finally give up this idea. --------- Co-authored-by: Jason Song Co-authored-by: Lunny Xiao --- modules/indexer/code/bleve.go | 5 +++-- modules/indexer/issues/bleve.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/indexer/code/bleve.go b/modules/indexer/code/bleve.go index 6ee2639d34f9..e9085f4107c0 100644 --- a/modules/indexer/code/bleve.go +++ b/modules/indexer/code/bleve.go @@ -27,6 +27,7 @@ import ( "github.com/blevesearch/bleve/v2" analyzer_custom "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" analyzer_keyword "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/v2/analysis/token/camelcase" "github.com/blevesearch/bleve/v2/analysis/token/lowercase" "github.com/blevesearch/bleve/v2/analysis/token/unicodenorm" "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" @@ -107,7 +108,7 @@ func (d *RepoIndexerData) Type() string { const ( repoIndexerAnalyzer = "repoIndexerAnalyzer" repoIndexerDocType = "repoIndexerDocType" - repoIndexerLatestVersion = 5 + repoIndexerLatestVersion = 6 ) // createBleveIndexer create a bleve repo indexer if one does not already exist @@ -138,7 +139,7 @@ func createBleveIndexer(path string, latestVersion int) (bleve.Index, error) { "type": analyzer_custom.Name, "char_filters": []string{}, "tokenizer": unicode.Name, - "token_filters": []string{unicodeNormalizeName, lowercase.Name}, + "token_filters": []string{unicodeNormalizeName, camelcase.Name, lowercase.Name}, }); err != nil { return nil, err } diff --git a/modules/indexer/issues/bleve.go b/modules/indexer/issues/bleve.go index 952bddfb292d..e3ef9af5b9a7 100644 --- a/modules/indexer/issues/bleve.go +++ b/modules/indexer/issues/bleve.go @@ -15,6 +15,7 @@ import ( "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" + "github.com/blevesearch/bleve/v2/analysis/token/camelcase" "github.com/blevesearch/bleve/v2/analysis/token/lowercase" "github.com/blevesearch/bleve/v2/analysis/token/unicodenorm" "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" @@ -27,7 +28,7 @@ import ( const ( issueIndexerAnalyzer = "issueIndexer" issueIndexerDocType = "issueIndexerDocType" - issueIndexerLatestVersion = 1 + issueIndexerLatestVersion = 2 ) // indexerID a bleve-compatible unique identifier for an integer id @@ -134,7 +135,7 @@ func createIssueIndexer(path string, latestVersion int) (bleve.Index, error) { "type": custom.Name, "char_filters": []string{}, "tokenizer": unicode.Name, - "token_filters": []string{unicodeNormalizeName, lowercase.Name}, + "token_filters": []string{unicodeNormalizeName, camelcase.Name, lowercase.Name}, }); err != nil { return nil, err } From a3546369661bf4073ae748a501840fbd05fef02b Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sun, 12 Feb 2023 19:19:50 +0800 Subject: [PATCH 2/2] Fix style of actions rerun button (#22835) Authored by @a1012112796 at https://github.com/go-gitea/gitea/pull/22798#issuecomment-1421820001 Avoid putting `button` in `a`. A patch for #22798 . Now it looks like: image image --------- Co-authored-by: silverwind Co-authored-by: Lunny Xiao --- web_src/js/components/RepoActionView.vue | 48 +++++++++++++++--------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 703fe59d811c..ddc7139a2e2e 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -12,19 +12,20 @@ @@ -291,7 +292,7 @@ export function initRepositoryActionView() { .action-view-header { margin: 0 20px 20px 20px; - button.run_cancel { + .run_cancel { border: none; color: var(--color-red); background-color: transparent; @@ -299,7 +300,7 @@ export function initRepositoryActionView() { cursor: pointer; transition:transform 0.2s; }; - button.run_cancel:hover{ + .run_cancel:hover{ transform:scale(130%); }; } @@ -327,14 +328,16 @@ export function initRepositoryActionView() { } .job-brief-list { - a.job-brief-item { - display: block; + .job-brief-item { margin: 5px 0; padding: 10px; background: var(--color-info-bg); border-radius: 5px; text-decoration: none; - button.job-brief-rerun { + display: flex; + justify-items: center; + flex-wrap: nowrap; + .job-brief-rerun { float: right; border: none; background-color: transparent; @@ -342,11 +345,20 @@ export function initRepositoryActionView() { cursor: pointer; transition:transform 0.2s; }; - button.job-brief-rerun:hover{ + .job-brief-rerun:hover{ transform:scale(130%); }; + .job-brief-link { + flex-grow: 1; + display: flex; + span { + margin-right: 8px; + display: flex; + align-items: center; + } + } } - a.job-brief-item:hover { + .job-brief-item:hover { background-color: var(--color-secondary); } }