diff --git a/VERSION b/VERSION index bb95160..8f92bfd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -33 +35 diff --git a/flake-info/src/elastic.rs b/flake-info/src/elastic.rs index eb16637..39f9b0b 100644 --- a/flake-info/src/elastic.rs +++ b/flake-info/src/elastic.rs @@ -65,7 +65,11 @@ lazy_static! { }, "package_attr_name": { "type": "keyword", - "fields": {"edge": {"type": "text", "analyzer": "edge"}}, + "fields": { + "edge": {"type": "text", "analyzer": "edge"}, + "attr_path": {"type": "text", "analyzer": "attr_path"}, + "attr_path_reverse": {"type": "text", "analyzer": "attr_path_reverse"} + }, }, "package_attr_set": { "type": "keyword", @@ -125,11 +129,11 @@ lazy_static! { // Options fields "option_name": { "type": "keyword", - "fields": {"edge": {"type": "text", "analyzer": "edge"}}, - }, - "option_name": { - "type": "keyword", - "fields": {"edge": {"type": "text", "analyzer": "edge"}}, + "fields": { + "edge": {"type": "text", "analyzer": "edge"}, + "attr_path": {"type": "text", "analyzer": "attr_path"}, + "attr_path_reverse": {"type": "text", "analyzer": "attr_path_reverse"} + }, }, "option_description": { "type": "text", @@ -155,14 +159,26 @@ lazy_static! { "token_chars": [ "letter", "digit", - // Either we use them or we would need to strip them before that. "punctuation", - "symbol", + "custom", ], + // Exclude XML characters < and > from "symbol" + "custom_token_chars": "+=~", + }, + "attr_path": { + "type": "path_hierarchy", + "delimiter": ".", + }, + "attr_path_reverse": { + "type": "path_hierarchy", + "delimiter": ".", + "reverse": true, }, }, "analyzer": { "edge": {"tokenizer": "edge", "filter": ["lowercase"]}, + "attr_path": {"tokenizer": "attr_path", "filter": ["lowercase"]}, + "attr_path_reverse": {"tokenizer": "attr_path_reverse", "filter": ["lowercase"]}, "lowercase": { "type": "custom", "tokenizer": "keyword", diff --git a/flake.nix b/flake.nix index 616b26d..481038c 100644 --- a/flake.nix +++ b/flake.nix @@ -96,6 +96,7 @@ ]; extraPackages = [ pkgs.rustfmt + pkgs.yarn ]; extraShellHook = '' export RUST_SRC_PATH="${pkgs.rustPlatform.rustLibSrc}"; @@ -115,6 +116,7 @@ devShells.frontend = mkDevShell { inputsFrom = [packages.frontend] ; + extraPackages = [pkgs.rustfmt pkgs.yarn]; extraShellHook = '' export PATH=$PWD/frontend/node_modules/.bin:$PATH rm -rf frontend/node_modules diff --git a/frontend/src/Search.elm b/frontend/src/Search.elm index 7940661..7038a13 100644 --- a/frontend/src/Search.elm +++ b/frontend/src/Search.elm @@ -1232,7 +1232,7 @@ searchFields query mainField fields = let allFields = fields - |> List.map (\( field, score ) -> [ field ++ "^" ++ String.fromFloat score, field ++ ".edge^" ++ String.fromFloat score ]) + |> List.map (\( field, score ) -> [ field ++ "^" ++ String.fromFloat score, field ++ ".*^" ++ String.fromFloat score ]) |> List.concat queryWords =