mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-08-29 15:25:16 +02:00
Refactor Search API and allow analyzer per field (#1755)
The Search api is now simpler, because it provides useful defaults. Only if you want to deviate from the defaults, you can set these values. This is mostly reached by using the builder pattern. Furthermore it is now possible to configure an analyzer per field. The default analyzer is still the one which is derived from the index options, but it is possible to configure a new indexer with the analyzer attribute of the indexed annotation. The attribute allows the configuration for code, identifiers and path. The current implementation uses the same analyzer code, identifiers and path. The new implemented splits tokens on more delimiters as the default analyzer e.g.: dots, underscores etc. Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -80,6 +80,42 @@ public @interface Indexed {
|
||||
*/
|
||||
boolean highlighted() default false;
|
||||
|
||||
/**
|
||||
* Describes how the field is analyzed and tokenized.
|
||||
*
|
||||
* @return type of analyzer
|
||||
* @since 2.23.0
|
||||
*/
|
||||
Analyzer analyzer() default Analyzer.DEFAULT;
|
||||
|
||||
/**
|
||||
* Describes how fields are analyzed and tokenized.
|
||||
*
|
||||
* @since 2.23.0
|
||||
*/
|
||||
enum Analyzer {
|
||||
|
||||
/**
|
||||
* Uses the analyzer which was used to open the index.
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* Uses an analyzer which is specialized for identifiers like repository names.
|
||||
*/
|
||||
IDENTIFIER,
|
||||
|
||||
/**
|
||||
* Uses an analyzer which is specialized for paths.
|
||||
*/
|
||||
PATH,
|
||||
|
||||
/**
|
||||
* Uses an analyzer which is specialized for source code.
|
||||
*/
|
||||
CODE
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes how the field is indexed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user