mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-12 13:23:26 +00:00
DATAES-2 Applied spring-data formatting to all sources
This commit is contained in:
parent
5e917b5ff6
commit
7df712a3b6
820
formatting.xml
820
formatting.xml
@ -0,0 +1,820 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="12">
|
||||||
|
<profile kind="CodeFormatterProfile" name="Spring Data"
|
||||||
|
version="12">
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.disabling_tag"
|
||||||
|
value="@formatter:off" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field"
|
||||||
|
value="0" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line"
|
||||||
|
value="false" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression"
|
||||||
|
value="80" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation"
|
||||||
|
value="2" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package"
|
||||||
|
value="0" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.align_type_members_on_columns"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration"
|
||||||
|
value="0" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size"
|
||||||
|
value="2" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag"
|
||||||
|
value="@formatter:on" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment"
|
||||||
|
value="0" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier"
|
||||||
|
value="error" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char"
|
||||||
|
value="tab" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body"
|
||||||
|
value="true" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration"
|
||||||
|
value="0" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier"
|
||||||
|
value="error" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch"
|
||||||
|
value="false" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size"
|
||||||
|
value="2" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer"
|
||||||
|
value="2" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
|
||||||
|
value="enabled" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line"
|
||||||
|
value="true" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments"
|
||||||
|
value="true" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length"
|
||||||
|
value="120" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
|
||||||
|
value="0" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration"
|
||||||
|
value="16" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
|
||||||
|
value="insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform"
|
||||||
|
value="1.7" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try"
|
||||||
|
value="80" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation"
|
||||||
|
value="0" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.format_block_comments"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants"
|
||||||
|
value="0" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration"
|
||||||
|
value="end_of_line" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries"
|
||||||
|
value="true" />
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports"
|
||||||
|
value="1" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
|
||||||
|
value="true" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for"
|
||||||
|
value="insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
|
||||||
|
value="do not insert" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column"
|
||||||
|
value="false" />
|
||||||
|
<setting
|
||||||
|
id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line"
|
||||||
|
value="false" />
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
8
pom.xml
8
pom.xml
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
@ -154,12 +155,13 @@
|
|||||||
<scm>
|
<scm>
|
||||||
<url>https://github.com/SpringSource/spring-data-elasticsearch</url>
|
<url>https://github.com/SpringSource/spring-data-elasticsearch</url>
|
||||||
<connection>scm:git:git://github.com/SpringSource/spring-data-elasticsearch.git</connection>
|
<connection>scm:git:git://github.com/SpringSource/spring-data-elasticsearch.git</connection>
|
||||||
<developerConnection>scm:git:ssh://git@github.com:SpringSource/spring-data-elasticsearch.git</developerConnection>
|
<developerConnection>scm:git:ssh://git@github.com:SpringSource/spring-data-elasticsearch.git
|
||||||
|
</developerConnection>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<ciManagement>
|
<ciManagement>
|
||||||
<system>Bamboo</system>
|
<system>Bamboo</system>
|
||||||
<url>http://build.springsource.org/browse/SPRINGDATAESh</url>
|
<url>http://build.springsource.org/browse/SPRINGDATAES</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
|
@ -35,8 +35,10 @@
|
|||||||
<part id="reference">
|
<part id="reference">
|
||||||
<title>Reference Documentation</title>
|
<title>Reference Documentation</title>
|
||||||
|
|
||||||
<xi:include href="https://raw.github.com/SpringSource/spring-data-commons/1.4.0.RC1/src/docbkx/repositories.xml">
|
<xi:include
|
||||||
<xi:fallback href="../../../spring-data-commons/src/docbkx/repositories.xml" />
|
href="https://raw.github.com/SpringSource/spring-data-commons/1.4.0.RC1/src/docbkx/repositories.xml">
|
||||||
|
<xi:fallback
|
||||||
|
href="../../../spring-data-commons/src/docbkx/repositories.xml" />
|
||||||
</xi:include>
|
</xi:include>
|
||||||
|
|
||||||
<xi:include href="reference/data-elasticsearch.xml" />
|
<xi:include href="reference/data-elasticsearch.xml" />
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||||
<preface id="preface">
|
<preface id="preface">
|
||||||
<title>Preface</title>
|
<title>Preface</title>
|
||||||
<para>The Spring Data Elasticsearch project applies core Spring concepts to
|
<para>The Spring Data Elasticsearch project applies core Spring
|
||||||
|
concepts to
|
||||||
the
|
the
|
||||||
development of solutions using the Elasticsearch Search Engine.
|
development of solutions using the Elasticsearch Search
|
||||||
|
Engine.
|
||||||
We have povided a "template" as a high-level abstraction for
|
We have povided a "template" as a high-level abstraction for
|
||||||
storing,querying,sorting and faceting documents. You will notice similarities
|
storing,querying,sorting and faceting documents. You will notice
|
||||||
|
similarities
|
||||||
to the Spring data solr and
|
to the Spring data solr and
|
||||||
mongodb support in the Spring Framework.
|
mongodb support in the Spring Framework.
|
||||||
</para>
|
</para>
|
||||||
@ -17,7 +20,8 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Version Control -
|
Version Control -
|
||||||
<ulink url="git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git">git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git
|
<ulink
|
||||||
|
url="git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git">git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git
|
||||||
</ulink>
|
</ulink>
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@ -28,7 +32,8 @@
|
|||||||
<para>
|
<para>
|
||||||
Requires
|
Requires
|
||||||
<ulink url="http://www.elasticsearch.org/download/">Elasticsearch</ulink>
|
<ulink url="http://www.elasticsearch.org/download/">Elasticsearch</ulink>
|
||||||
0.20.2 and above or optional dependency or not even that if you are using Embedded Node Client
|
0.20.2 and above or optional dependency or not even that if you are
|
||||||
|
using Embedded Node Client
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
</preface>
|
</preface>
|
@ -15,8 +15,10 @@
|
|||||||
<title>Spring Namespace</title>
|
<title>Spring Namespace</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The Spring Data Elasticsearch module contains a custom namespace allowing
|
The Spring Data Elasticsearch module contains a custom namespace
|
||||||
definition of repository beans as well as elements for instantiating
|
allowing
|
||||||
|
definition of repository beans as well as elements for
|
||||||
|
instantiating
|
||||||
a
|
a
|
||||||
<classname>ElasticsearchServer</classname>
|
<classname>ElasticsearchServer</classname>
|
||||||
.
|
.
|
||||||
@ -87,12 +89,14 @@ http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.
|
|||||||
</section>
|
</section>
|
||||||
<section id="elasticsearch.annotation">
|
<section id="elasticsearch.annotation">
|
||||||
<title>Annotation based configuration</title>
|
<title>Annotation based configuration</title>
|
||||||
<para>The Spring Data Elasticsearch repositories support cannot only be
|
<para>The Spring Data Elasticsearch repositories support cannot only
|
||||||
|
be
|
||||||
activated through an XML namespace but also using an annotation
|
activated through an XML namespace but also using an annotation
|
||||||
through JavaConfig.
|
through JavaConfig.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Spring Data Elasticsearch repositories using JavaConfig</title>
|
<title>Spring Data Elasticsearch repositories using JavaConfig
|
||||||
|
</title>
|
||||||
<programlisting language="java">
|
<programlisting language="java">
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableElasticsearchRepositories(basePackages = "org/springframework/data/elasticsearch/repositories")
|
@EnableElasticsearchRepositories(basePackages = "org/springframework/data/elasticsearch/repositories")
|
||||||
@ -122,11 +126,13 @@ return new ElasticsearchTemplate(nodeBuilder().local(true).node().client());
|
|||||||
</section>
|
</section>
|
||||||
<section id="elasticsearch.cdi">
|
<section id="elasticsearch.cdi">
|
||||||
<title>Elasticsearch Repositores using CDI</title>
|
<title>Elasticsearch Repositores using CDI</title>
|
||||||
<para>The Spring Data Elasticsearch repositories can also be set up using CDI
|
<para>The Spring Data Elasticsearch repositories can also be set up
|
||||||
|
using CDI
|
||||||
functionality.
|
functionality.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Spring Data Elasticsearch repositories using JavaConfig</title>
|
<title>Spring Data Elasticsearch repositories using JavaConfig
|
||||||
|
</title>
|
||||||
<programlisting language="java">class ElasticsearchTemplateProducer {
|
<programlisting language="java">class ElasticsearchTemplateProducer {
|
||||||
|
|
||||||
@Produces
|
@Produces
|
||||||
@ -157,9 +163,11 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<section id="elasticsearch.query-methods.finders">
|
<section id="elasticsearch.query-methods.finders">
|
||||||
<title>Query lookup strategies</title>
|
<title>Query lookup strategies</title>
|
||||||
<para>
|
<para>
|
||||||
The Elasticsearch module supports all basic query building feature as String,Abstract,Criteria or
|
The Elasticsearch module supports all basic query building
|
||||||
|
feature as String,Abstract,Criteria or
|
||||||
have
|
have
|
||||||
it being derived from the method name.
|
it being derived from the
|
||||||
|
method name.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<simplesect>
|
<simplesect>
|
||||||
@ -180,11 +188,13 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<title>Query creation</title>
|
<title>Query creation</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Generally the query creation mechanism for Elasticsearch works as described
|
Generally the query creation mechanism for Elasticsearch works as
|
||||||
|
described
|
||||||
in
|
in
|
||||||
<xref linkend="repositories.query-methods" />
|
<xref linkend="repositories.query-methods" />
|
||||||
. Here's a short example
|
. Here's a short example
|
||||||
of what a Elasticsearch query method translates into:
|
of what a Elasticsearch query method
|
||||||
|
translates into:
|
||||||
<example>
|
<example>
|
||||||
<title>Query creation from method names</title>
|
<title>Query creation from method names</title>
|
||||||
<programlisting language="java">public interface BookRepository extends Repository<Book, String> {
|
<programlisting language="java">public interface BookRepository extends Repository<Book, String> {
|
||||||
@ -227,7 +237,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameAndPrice</code>
|
<code>findByNameAndPrice</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}</code>
|
<code>{"bool" : {"must" : [ {"field" : {"name" : "?"}},
|
||||||
|
{"field" : {"price" : "?"}} ]}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -238,7 +249,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameOrPrice</code>
|
<code>findByNameOrPrice</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}</code>
|
<code>{"bool" : {"should" : [ {"field" : {"name" : "?"}},
|
||||||
|
{"field" : {"price" : "?"}} ]}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -260,7 +272,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameNot</code>
|
<code>findByNameNot</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must_not" : {"field" : {"name" : "?"}}}}</code>
|
<code>{"bool" : {"must_not" : {"field" : {"name" : "?"}}}}
|
||||||
|
</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -271,7 +284,9 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByPriceBetween</code>
|
<code>findByPriceBetween</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"range" : {"price" : {"from" :
|
||||||
|
?,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
|
||||||
|
</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -282,7 +297,9 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByPriceLessThan</code>
|
<code>findByPriceLessThan</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"range" : {"price" : {"from" :
|
||||||
|
null,"to" : ?,"include_lower" : true,"include_upper" :
|
||||||
|
true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -293,7 +310,9 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByPriceGreaterThan</code>
|
<code>findByPriceGreaterThan</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"range" : {"price" : {"from" :
|
||||||
|
?,"to" : null,"include_lower" : true,"include_upper" :
|
||||||
|
true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -304,7 +323,9 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByPriceBefore</code>
|
<code>findByPriceBefore</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"range" : {"price" : {"from" :
|
||||||
|
null,"to" : ?,"include_lower" : true,"include_upper" :
|
||||||
|
true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -315,7 +336,9 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByPriceAfter</code>
|
<code>findByPriceAfter</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"range" : {"price" : {"from" :
|
||||||
|
?,"to" : null,"include_lower" : true,"include_upper" :
|
||||||
|
true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -326,7 +349,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameLike</code>
|
<code>findByNameLike</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||||
|
"?*","analyze_wildcard" : true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -337,7 +361,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameStartingWith</code>
|
<code>findByNameStartingWith</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||||
|
"?*","analyze_wildcard" : true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -348,7 +373,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameEndingWith</code>
|
<code>findByNameEndingWith</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "*?","analyze_wildcard" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||||
|
"*?","analyze_wildcard" : true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -359,7 +385,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameContaining</code>
|
<code>findByNameContaining</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "*?*","analyze_wildcard" : true}}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||||
|
"*?*","analyze_wildcard" : true}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -370,7 +397,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameIn(Collection<String>names)</code>
|
<code>findByNameIn(Collection<String>names)</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}</code>
|
<code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" :
|
||||||
|
{"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -381,7 +409,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByNameNotIn(Collection<String>names)</code>
|
<code>findByNameNotIn(Collection<String>names)</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" : {"name" : "?"}}}}}}</code>
|
<code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" :
|
||||||
|
{"name" : "?"}}}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -403,7 +432,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByAvailableTrue</code>
|
<code>findByAvailableTrue</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"available" : true}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"available" : true}}}}
|
||||||
|
</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -414,7 +444,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByAvailableFalse</code>
|
<code>findByAvailableFalse</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"bool" : {"must" : {"field" : {"available" : false}}}}</code>
|
<code>{"bool" : {"must" : {"field" : {"available" : false}}}}
|
||||||
|
</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -425,7 +456,8 @@ public void setRepository(ProductRepository repository) {
|
|||||||
<code>findByAvailableTrueOrderByNameDesc</code>
|
<code>findByAvailableTrueOrderByNameDesc</code>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<code>{"sort" : [{ "name" : {"order" : "desc"} }],"bool" : {"must" : {"field" : {"available" : true}}}}</code>
|
<code>{"sort" : [{ "name" : {"order" : "desc"} }],"bool" :
|
||||||
|
{"must" : {"field" : {"available" : true}}}}</code>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
This chapter covers additional support for Elasticsearch operations
|
This chapter covers additional support for Elasticsearch operations
|
||||||
that cannot be directly accessed via the repository
|
that cannot be directly accessed via the repository
|
||||||
interface.
|
interface.
|
||||||
It is recommended to add those operations as custom
|
It is
|
||||||
|
recommended to add those operations as custom
|
||||||
implementation as
|
implementation as
|
||||||
described in
|
described in
|
||||||
<xref linkend="repositories.custom-implementations" />
|
<xref linkend="repositories.custom-implementations" />
|
||||||
@ -34,7 +35,8 @@ Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(sea
|
|||||||
<section id="elasticsearch.scan.and.scroll">
|
<section id="elasticsearch.scan.and.scroll">
|
||||||
<title>Using Scan And Scroll For Big Result Set</title>
|
<title>Using Scan And Scroll For Big Result Set</title>
|
||||||
<para>
|
<para>
|
||||||
Elasticsearch has scan and scroll feature for getting big result set in chunks.
|
Elasticsearch has scan and scroll feature for getting big result set
|
||||||
|
in chunks.
|
||||||
<interfacename>ElasticsearchTemplate</interfacename>
|
<interfacename>ElasticsearchTemplate</interfacename>
|
||||||
has scan and scroll methods that can be used as below.
|
has scan and scroll methods that can be used as below.
|
||||||
</para>
|
</para>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@
|
|||||||
code highlight CSS resemblign the Eclipse IDE default color schema
|
code highlight CSS resemblign the Eclipse IDE default color schema
|
||||||
@author Costin Leau
|
@author Costin Leau
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.hl-keyword {
|
.hl-keyword {
|
||||||
color: #7F0055;
|
color: #7F0055;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/css/html.css
|
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/css/html.css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@IMPORT url("highlight.css");
|
@IMPORT url("highlight.css");
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@ -12,7 +11,8 @@ html {
|
|||||||
body {
|
body {
|
||||||
margin-left: 15%;
|
margin-left: 15%;
|
||||||
margin-right: 15%;
|
margin-right: 15%;
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
@ -31,7 +31,8 @@ hr {
|
|||||||
|
|
||||||
h1,h2,h3,h4,h5 {
|
h1,h2,h3,h4,h5 {
|
||||||
color: #234623;
|
color: #234623;
|
||||||
font-weight: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-weight: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
margin-bottom: 0em;
|
margin-bottom: 0em;
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
@ -85,7 +86,8 @@ div.table td {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.legalnotice {
|
.legalnotice {
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
@ -93,20 +95,23 @@ div.table td {
|
|||||||
p.releaseinfo {
|
p.releaseinfo {
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.pubdate {
|
p.pubdate {
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.productname {
|
span.productname {
|
||||||
font-size: 200%;
|
font-size: 200%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||||
|
sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!-- borrowed from: https://raw.github.com/SpringSource/spring-data-commons/master/src/docbkx/resources/xsl/fopdf.xsl
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-commons/master/src/docbkx/resources/xsl/fopdf.xsl
|
This is the XSL FO (PDF) stylesheet for the Spring Data reference documentation. -->
|
||||||
This is the XSL FO (PDF) stylesheet for the Spring Data reference
|
|
||||||
documentation.
|
|
||||||
-->
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
|
|
||||||
<xsl:import href="urn:docbkx:stylesheet" />
|
<xsl:import href="urn:docbkx:stylesheet" />
|
||||||
<xsl:import href="highlight-fo.xsl" />
|
<xsl:import href="highlight-fo.xsl" />
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Custom Title Page
|
||||||
Custom Title Page
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
|
|
||||||
<xsl:template name="book.titlepage.recto">
|
<xsl:template name="book.titlepage.recto">
|
||||||
@ -23,27 +18,32 @@
|
|||||||
<fo:table-body>
|
<fo:table-body>
|
||||||
<fo:table-row>
|
<fo:table-row>
|
||||||
<fo:table-cell text-align="center">
|
<fo:table-cell text-align="center">
|
||||||
<fo:block font-family="Helvetica" font-size="22pt" padding-before="10mm">
|
<fo:block font-family="Helvetica" font-size="22pt"
|
||||||
|
padding-before="10mm">
|
||||||
<xsl:value-of select="bookinfo/subtitle" />
|
<xsl:value-of select="bookinfo/subtitle" />
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<fo:block font-family="Helvetica" font-size="14pt" padding="10mm">
|
<fo:block font-family="Helvetica" font-size="14pt"
|
||||||
|
padding="10mm">
|
||||||
<xsl:value-of select="bookinfo/title" />
|
<xsl:value-of select="bookinfo/title" />
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
<fo:block font-family="Helvetica" font-size="12pt"
|
||||||
|
padding="10mm">
|
||||||
<xsl:value-of select="bookinfo/releaseinfo" />
|
<xsl:value-of select="bookinfo/releaseinfo" />
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
<fo:table-row>
|
<fo:table-row>
|
||||||
<fo:table-cell text-align="center">
|
<fo:table-cell text-align="center">
|
||||||
<fo:block font-family="Helvetica" font-size="14pt" padding="10mm">
|
<fo:block font-family="Helvetica" font-size="14pt"
|
||||||
|
padding="10mm">
|
||||||
<xsl:value-of select="bookinfo/pubdate" />
|
<xsl:value-of select="bookinfo/pubdate" />
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
<fo:table-row>
|
<fo:table-row>
|
||||||
<fo:table-cell text-align="center">
|
<fo:table-cell text-align="center">
|
||||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
<fo:block font-family="Helvetica" font-size="12pt"
|
||||||
|
padding="10mm">
|
||||||
<xsl:for-each select="bookinfo/authorgroup/author">
|
<xsl:for-each select="bookinfo/authorgroup/author">
|
||||||
<xsl:if test="position() > 1">
|
<xsl:if test="position() > 1">
|
||||||
<xsl:text>, </xsl:text>
|
<xsl:text>, </xsl:text>
|
||||||
@ -51,16 +51,17 @@
|
|||||||
<xsl:value-of select="firstname" />
|
<xsl:value-of select="firstname" />
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="surname" />
|
<xsl:value-of select="surname" />
|
||||||
<!-- <xsl:text> (</xsl:text>
|
<!-- <xsl:text> (</xsl:text> <xsl:value-of select="affiliation"/>
|
||||||
<xsl:value-of select="affiliation"/>
|
|
||||||
<xsl:text>)</xsl:text> -->
|
<xsl:text>)</xsl:text> -->
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
<fo:block font-family="Helvetica" font-size="12pt"
|
||||||
|
padding="10mm">
|
||||||
<xsl:text>Copyright © 2013</xsl:text>
|
<xsl:text>Copyright © 2013</xsl:text>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
|
|
||||||
<fo:block font-family="Helvetica" font-size="10pt" padding="1mm">
|
<fo:block font-family="Helvetica" font-size="10pt"
|
||||||
|
padding="1mm">
|
||||||
<xsl:value-of select="bookinfo/legalnotice" />
|
<xsl:value-of select="bookinfo/legalnotice" />
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
@ -78,9 +79,7 @@
|
|||||||
<xsl:template name="book.titlepage.separator">
|
<xsl:template name="book.titlepage.separator">
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Header ################################################### -->
|
||||||
Header
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- More space in the center header for long text -->
|
<!-- More space in the center header for long text -->
|
||||||
<xsl:attribute-set name="header.content.properties">
|
<xsl:attribute-set name="header.content.properties">
|
||||||
@ -91,9 +90,7 @@
|
|||||||
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Custom Footer ################################################### -->
|
||||||
Custom Footer
|
|
||||||
################################################### -->
|
|
||||||
<xsl:template name="footer.content">
|
<xsl:template name="footer.content">
|
||||||
<xsl:param name="pageclass" select="''" />
|
<xsl:param name="pageclass" select="''" />
|
||||||
<xsl:param name="sequence" select="''" />
|
<xsl:param name="sequence" select="''" />
|
||||||
@ -101,7 +98,9 @@
|
|||||||
<xsl:param name="gentext-key" select="''" />
|
<xsl:param name="gentext-key" select="''" />
|
||||||
<xsl:variable name="Version">
|
<xsl:variable name="Version">
|
||||||
<xsl:if test="//releaseinfo">
|
<xsl:if test="//releaseinfo">
|
||||||
<xsl:text>Spring Data Elasticsearch (</xsl:text><xsl:value-of select="//releaseinfo" /><xsl:text>)</xsl:text>
|
<xsl:text>Spring Data Elasticsearch (</xsl:text>
|
||||||
|
<xsl:value-of select="//releaseinfo" />
|
||||||
|
<xsl:text>)</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
@ -110,7 +109,8 @@
|
|||||||
<xsl:value-of select="$Version" />
|
<xsl:value-of select="$Version" />
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- for double sided printing, print page numbers on alternating sides (of the page) -->
|
<!-- for double sided printing, print page numbers on alternating sides
|
||||||
|
(of the page) -->
|
||||||
<xsl:when test="$double.sided != 0">
|
<xsl:when test="$double.sided != 0">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$sequence = 'even' and $position='left'">
|
<xsl:when test="$sequence = 'even' and $position='left'">
|
||||||
@ -124,7 +124,8 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- for single sided printing, print all page numbers on the right (of the page) -->
|
<!-- for single sided printing, print all page numbers on the right (of
|
||||||
|
the page) -->
|
||||||
<xsl:when test="$double.sided = 0">
|
<xsl:when test="$double.sided = 0">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$position='center'">
|
<xsl:when test="$position='center'">
|
||||||
@ -138,19 +139,24 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Extensions ################################################### -->
|
||||||
Extensions
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- These extensions are required for table printing and other stuff -->
|
<!-- These extensions are required for table printing and other stuff -->
|
||||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
<xsl:param name="tablecolumns.extension">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
<!-- FOP provide only PDF Bookmarks at the moment -->
|
<!-- FOP provide only PDF Bookmarks at the moment -->
|
||||||
<xsl:param name="fop.extensions">1</xsl:param>
|
<xsl:param name="fop.extensions">
|
||||||
<xsl:param name="fop1.extensions">1</xsl:param>
|
1
|
||||||
<xsl:param name="ignore.image.scaling">0</xsl:param>
|
</xsl:param>
|
||||||
|
<xsl:param name="fop1.extensions">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="ignore.image.scaling">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Table Of Contents
|
||||||
Table Of Contents
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
|
|
||||||
<!-- Generate the TOCs for named components only -->
|
<!-- Generate the TOCs for named components only -->
|
||||||
@ -159,51 +165,84 @@
|
|||||||
</xsl:param>
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||||
<xsl:param name="toc.section.depth">2</xsl:param>
|
<xsl:param name="toc.section.depth">
|
||||||
|
2
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Dot and Whitespace as separator in TOC between Label and Title -->
|
<!-- Dot and Whitespace as separator in TOC between Label and Title -->
|
||||||
<xsl:param name="autotoc.label.separator" select="'. '" />
|
<xsl:param name="autotoc.label.separator" select="'. '" />
|
||||||
|
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Paper & Page Size
|
||||||
Paper & Page Size
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
|
|
||||||
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
||||||
<xsl:param name="paper.type" select="'A4'" />
|
<xsl:param name="paper.type" select="'A4'" />
|
||||||
<xsl:param name="double.sided">0</xsl:param>
|
<xsl:param name="double.sided">
|
||||||
<xsl:param name="headers.on.blank.pages">0</xsl:param>
|
0
|
||||||
<xsl:param name="footers.on.blank.pages">0</xsl:param>
|
</xsl:param>
|
||||||
|
<xsl:param name="headers.on.blank.pages">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="footers.on.blank.pages">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Space between paper border and content (chaotic stuff, don't touch) -->
|
<!-- Space between paper border and content (chaotic stuff, don't touch) -->
|
||||||
<xsl:param name="page.margin.top">5mm</xsl:param>
|
<xsl:param name="page.margin.top">
|
||||||
<xsl:param name="region.before.extent">10mm</xsl:param>
|
5mm
|
||||||
<xsl:param name="body.margin.top">10mm</xsl:param>
|
</xsl:param>
|
||||||
|
<xsl:param name="region.before.extent">
|
||||||
|
10mm
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="body.margin.top">
|
||||||
|
10mm
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<xsl:param name="body.margin.bottom">15mm</xsl:param>
|
<xsl:param name="body.margin.bottom">
|
||||||
<xsl:param name="region.after.extent">10mm</xsl:param>
|
15mm
|
||||||
<xsl:param name="page.margin.bottom">0mm</xsl:param>
|
</xsl:param>
|
||||||
|
<xsl:param name="region.after.extent">
|
||||||
|
10mm
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="page.margin.bottom">
|
||||||
|
0mm
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<xsl:param name="page.margin.outer">18mm</xsl:param>
|
<xsl:param name="page.margin.outer">
|
||||||
<xsl:param name="page.margin.inner">18mm</xsl:param>
|
18mm
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="page.margin.inner">
|
||||||
|
18mm
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- No intendation of Titles -->
|
<!-- No intendation of Titles -->
|
||||||
<xsl:param name="title.margin.left">0pc</xsl:param>
|
<xsl:param name="title.margin.left">
|
||||||
|
0pc
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Fonts & Styles ################################################### -->
|
||||||
Fonts & Styles
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Left aligned text and no hyphenation -->
|
<!-- Left aligned text and no hyphenation -->
|
||||||
<xsl:param name="alignment">justify</xsl:param>
|
<xsl:param name="alignment">
|
||||||
<xsl:param name="hyphenate">false</xsl:param>
|
justify
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="hyphenate">
|
||||||
|
false
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Default Font size -->
|
<!-- Default Font size -->
|
||||||
<xsl:param name="body.font.master">11</xsl:param>
|
<xsl:param name="body.font.master">
|
||||||
<xsl:param name="body.font.small">8</xsl:param>
|
11
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="body.font.small">
|
||||||
|
8
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Line height in body text -->
|
<!-- Line height in body text -->
|
||||||
<xsl:param name="line-height">1.4</xsl:param>
|
<xsl:param name="line-height">
|
||||||
|
1.4
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Monospaced fonts are smaller than regular text -->
|
<!-- Monospaced fonts are smaller than regular text -->
|
||||||
<xsl:attribute-set name="monospace.properties">
|
<xsl:attribute-set name="monospace.properties">
|
||||||
@ -213,12 +252,12 @@
|
|||||||
<xsl:attribute name="font-size">0.8em</xsl:attribute>
|
<xsl:attribute name="font-size">0.8em</xsl:attribute>
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Tables ################################################### -->
|
||||||
Tables
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- The table width should be adapted to the paper size -->
|
<!-- The table width should be adapted to the paper size -->
|
||||||
<xsl:param name="default.table.width">17.4cm</xsl:param>
|
<xsl:param name="default.table.width">
|
||||||
|
17.4cm
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Some padding inside tables -->
|
<!-- Some padding inside tables -->
|
||||||
<xsl:attribute-set name="table.cell.padding">
|
<xsl:attribute-set name="table.cell.padding">
|
||||||
@ -229,21 +268,24 @@
|
|||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!-- Only hairlines as frame and cell borders in tables -->
|
<!-- Only hairlines as frame and cell borders in tables -->
|
||||||
<xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
|
<xsl:param name="table.frame.border.thickness">
|
||||||
<xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
|
0.1pt
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="table.cell.border.thickness">
|
||||||
|
0.1pt
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Labels ################################################### -->
|
||||||
Labels
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Label Chapters and Sections (numbering) -->
|
<!-- Label Chapters and Sections (numbering) -->
|
||||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
<xsl:param name="chapter.autolabel">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
<xsl:param name="section.autolabel" select="1" />
|
<xsl:param name="section.autolabel" select="1" />
|
||||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
<xsl:param name="section.label.includes.component.label"
|
||||||
|
select="1" />
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Titles ################################################### -->
|
||||||
Titles
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Chapter title size -->
|
<!-- Chapter title size -->
|
||||||
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
||||||
@ -305,7 +347,8 @@
|
|||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!-- Titles of formal objects (tables, examples, ...) -->
|
<!-- Titles of formal objects (tables, examples, ...) -->
|
||||||
<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
|
<xsl:attribute-set name="formal.title.properties"
|
||||||
|
use-attribute-sets="normal.para.spacing">
|
||||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||||
<xsl:attribute name="font-size">
|
<xsl:attribute name="font-size">
|
||||||
<xsl:value-of select="$body.font.master" />
|
<xsl:value-of select="$body.font.master" />
|
||||||
@ -317,8 +360,7 @@
|
|||||||
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
|
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Programlistings
|
||||||
Programlistings
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
|
|
||||||
<!-- Verbatim text formatting (programlistings) -->
|
<!-- Verbatim text formatting (programlistings) -->
|
||||||
@ -345,33 +387,39 @@
|
|||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!-- Shade (background) programlistings -->
|
<!-- Shade (background) programlistings -->
|
||||||
<xsl:param name="shade.verbatim">1</xsl:param>
|
<xsl:param name="shade.verbatim">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
<xsl:attribute-set name="shade.verbatim.style">
|
<xsl:attribute-set name="shade.verbatim.style">
|
||||||
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Callouts ################################################### -->
|
||||||
Callouts
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Use images for callouts instead of (1) (2) (3) -->
|
<!-- Use images for callouts instead of (1) (2) (3) -->
|
||||||
<xsl:param name="callout.graphics">0</xsl:param>
|
<xsl:param name="callout.graphics">
|
||||||
<xsl:param name="callout.unicode">1</xsl:param>
|
0
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="callout.unicode">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Place callout marks at this column in annotated areas -->
|
<!-- Place callout marks at this column in annotated areas -->
|
||||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
<xsl:param name="callout.defaultcolumn">
|
||||||
|
90
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Admonitions ################################################### -->
|
||||||
Admonitions
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Use nice graphics for admonitions -->
|
<!-- Use nice graphics for admonitions -->
|
||||||
<xsl:param name="admon.graphics">'1'</xsl:param>
|
<xsl:param name="admon.graphics">
|
||||||
<xsl:param name="admon.graphics.path">src/docbkx/resources/images/admons/</xsl:param>
|
'1'
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="admon.graphics.path">
|
||||||
|
src/docbkx/resources/images/admons/
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Misc ################################################### -->
|
||||||
Misc
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Placement of titles -->
|
<!-- Placement of titles -->
|
||||||
<xsl:param name="formal.title.placement">
|
<xsl:param name="formal.title.placement">
|
||||||
@ -383,7 +431,9 @@
|
|||||||
</xsl:param>
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
|
<!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
|
||||||
<xsl:param name="variablelist.as.blocks">1</xsl:param>
|
<xsl:param name="variablelist.as.blocks">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- The horrible list spacing problems -->
|
<!-- The horrible list spacing problems -->
|
||||||
<xsl:attribute-set name="list.block.spacing">
|
<xsl:attribute-set name="list.block.spacing">
|
||||||
@ -395,13 +445,11 @@
|
|||||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||||
</xsl:attribute-set>
|
</xsl:attribute-set>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### colored and hyphenated
|
||||||
colored and hyphenated links
|
links ################################################### -->
|
||||||
################################################### -->
|
|
||||||
<xsl:template match="ulink">
|
<xsl:template match="ulink">
|
||||||
<fo:basic-link external-destination="{@url}"
|
<fo:basic-link external-destination="{@url}"
|
||||||
xsl:use-attribute-sets="xref.properties"
|
xsl:use-attribute-sets="xref.properties" text-decoration="underline"
|
||||||
text-decoration="underline"
|
|
||||||
color="blue">
|
color="blue">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="count(child::node())=0">
|
<xsl:when test="count(child::node())=0">
|
||||||
@ -416,8 +464,7 @@
|
|||||||
|
|
||||||
<xsl:template match="link">
|
<xsl:template match="link">
|
||||||
<fo:basic-link internal-destination="{@linkend}"
|
<fo:basic-link internal-destination="{@linkend}"
|
||||||
xsl:use-attribute-sets="xref.properties"
|
xsl:use-attribute-sets="xref.properties" text-decoration="underline"
|
||||||
text-decoration="underline"
|
|
||||||
color="blue">
|
color="blue">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="count(child::node())=0">
|
<xsl:when test="count(child::node())=0">
|
||||||
|
@ -1,45 +1,57 @@
|
|||||||
<?xml version='1.0'?>
|
<?xml version='1.0'?>
|
||||||
<!--
|
<!-- borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/highlight-fo.xsl
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/highlight-fo.xsl
|
Simple highlighter for FO/PDF output. Follows the Eclipse color scheme. -->
|
||||||
Simple highlighter for FO/PDF output. Follows the Eclipse color scheme.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xslthl="http://xslthl.sf.net"
|
||||||
xmlns:xslthl="http://xslthl.sf.net"
|
exclude-result-prefixes="xslthl" version='1.0'>
|
||||||
exclude-result-prefixes="xslthl"
|
|
||||||
version='1.0'>
|
|
||||||
|
|
||||||
<xsl:template match='xslthl:keyword'>
|
<xsl:template match='xslthl:keyword'>
|
||||||
<fo:inline font-weight="bold" color="#7F0055"><xsl:apply-templates/></fo:inline>
|
<fo:inline font-weight="bold" color="#7F0055">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:comment'>
|
<xsl:template match='xslthl:comment'>
|
||||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
<fo:inline font-style="italic" color="#3F5F5F">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:oneline-comment'>
|
<xsl:template match='xslthl:oneline-comment'>
|
||||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
<fo:inline font-style="italic" color="#3F5F5F">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:multiline-comment'>
|
<xsl:template match='xslthl:multiline-comment'>
|
||||||
<fo:inline font-style="italic" color="#3F5FBF"><xsl:apply-templates/></fo:inline>
|
<fo:inline font-style="italic" color="#3F5FBF">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:tag'>
|
<xsl:template match='xslthl:tag'>
|
||||||
<fo:inline color="#3F7F7F"><xsl:apply-templates/></fo:inline>
|
<fo:inline color="#3F7F7F">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:attribute'>
|
<xsl:template match='xslthl:attribute'>
|
||||||
<fo:inline color="#7F007F"><xsl:apply-templates/></fo:inline>
|
<fo:inline color="#7F007F">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:value'>
|
<xsl:template match='xslthl:value'>
|
||||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
<fo:inline color="#2A00FF">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:string'>
|
<xsl:template match='xslthl:string'>
|
||||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
<fo:inline color="#2A00FF">
|
||||||
|
<xsl:apply-templates />
|
||||||
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
@ -1,43 +1,56 @@
|
|||||||
<?xml version='1.0'?>
|
<?xml version='1.0'?>
|
||||||
<!--
|
<!-- borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/highlight.xsl
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/highlight.xsl
|
Simple highlighter for HTML output. Follows the Eclipse color scheme. -->
|
||||||
Simple highlighter for HTML output. Follows the Eclipse color scheme.
|
|
||||||
-->
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:xslthl="http://xslthl.sf.net"
|
xmlns:xslthl="http://xslthl.sf.net" exclude-result-prefixes="xslthl"
|
||||||
exclude-result-prefixes="xslthl"
|
|
||||||
version='1.0'>
|
version='1.0'>
|
||||||
|
|
||||||
<xsl:template match='xslthl:keyword'>
|
<xsl:template match='xslthl:keyword'>
|
||||||
<span class="hl-keyword"><xsl:value-of select='.'/></span>
|
<span class="hl-keyword">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:comment'>
|
<xsl:template match='xslthl:comment'>
|
||||||
<span class="hl-comment"><xsl:value-of select='.'/></span>
|
<span class="hl-comment">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:oneline-comment'>
|
<xsl:template match='xslthl:oneline-comment'>
|
||||||
<span class="hl-comment"><xsl:value-of select='.'/></span>
|
<span class="hl-comment">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:multiline-comment'>
|
<xsl:template match='xslthl:multiline-comment'>
|
||||||
<span class="hl-multiline-comment"><xsl:value-of select='.'/></span>
|
<span class="hl-multiline-comment">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:tag'>
|
<xsl:template match='xslthl:tag'>
|
||||||
<span class="hl-tag"><xsl:value-of select='.'/></span>
|
<span class="hl-tag">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:attribute'>
|
<xsl:template match='xslthl:attribute'>
|
||||||
<span class="hl-attribute"><xsl:value-of select='.'/></span>
|
<span class="hl-attribute">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:value'>
|
<xsl:template match='xslthl:value'>
|
||||||
<span class="hl-value"><xsl:value-of select='.'/></span>
|
<span class="hl-value">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='xslthl:string'>
|
<xsl:template match='xslthl:string'>
|
||||||
<span class="hl-string"><xsl:value-of select='.'/></span>
|
<span class="hl-string">
|
||||||
|
<xsl:value-of select='.' />
|
||||||
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
@ -1,29 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!-- borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/html.xsl
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/html.xsl
|
This is the XSL HTML configuration file for the Spring Reference Documentation. -->
|
||||||
This is the XSL HTML configuration file for the Spring
|
|
||||||
Reference Documentation.
|
|
||||||
-->
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xslthl="http://xslthl.sf.net"
|
||||||
xmlns:xslthl="http://xslthl.sf.net"
|
exclude-result-prefixes="xslthl" version="1.0">
|
||||||
exclude-result-prefixes="xslthl"
|
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<xsl:import href="urn:docbkx:stylesheet" />
|
<xsl:import href="urn:docbkx:stylesheet" />
|
||||||
<xsl:import href="highlight.xsl" />
|
<xsl:import href="highlight.xsl" />
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### HTML Settings ################################################### -->
|
||||||
HTML Settings
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- These extensions are required for table printing and other stuff -->
|
<!-- These extensions are required for table printing and other stuff -->
|
||||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
<xsl:param name="tablecolumns.extension">
|
||||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
0
|
||||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
</xsl:param>
|
||||||
|
<xsl:param name="graphicsize.extension">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="ignore.image.scaling">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Table Of Contents
|
||||||
Table Of Contents
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
|
|
||||||
<!-- Generate the TOCs for named components only -->
|
<!-- Generate the TOCs for named components only -->
|
||||||
@ -32,37 +30,42 @@
|
|||||||
</xsl:param>
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
<xsl:param name="toc.section.depth">
|
||||||
|
3
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Labels ################################################### -->
|
||||||
Labels
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Label Chapters and Sections (numbering) -->
|
<!-- Label Chapters and Sections (numbering) -->
|
||||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
<xsl:param name="chapter.autolabel">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
<xsl:param name="section.autolabel" select="1" />
|
<xsl:param name="section.autolabel" select="1" />
|
||||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
<xsl:param name="section.label.includes.component.label"
|
||||||
|
select="1" />
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Callouts ################################################### -->
|
||||||
Callouts
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Use images for callouts instead of (1) (2) (3) -->
|
<!-- Use images for callouts instead of (1) (2) (3) -->
|
||||||
<xsl:param name="callout.graphics">1</xsl:param>
|
<xsl:param name="callout.graphics">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!-- Place callout marks at this column in annotated areas -->
|
<!-- Place callout marks at this column in annotated areas -->
|
||||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
<xsl:param name="callout.defaultcolumn">
|
||||||
|
90
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Admonitions ################################################### -->
|
||||||
Admonitions
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Use nice graphics for admonitions -->
|
<!-- Use nice graphics for admonitions -->
|
||||||
<xsl:param name="admon.graphics">1</xsl:param>
|
<xsl:param name="admon.graphics">
|
||||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
1
|
||||||
<!--###################################################
|
</xsl:param>
|
||||||
Misc
|
<xsl:param name="admon.graphics.path">
|
||||||
################################################### -->
|
images/admons/
|
||||||
|
</xsl:param>
|
||||||
|
<!--################################################### Misc ################################################### -->
|
||||||
<!-- Placement of titles -->
|
<!-- Placement of titles -->
|
||||||
<xsl:param name="formal.title.placement">
|
<xsl:param name="formal.title.placement">
|
||||||
figure after
|
figure after
|
||||||
@ -78,7 +81,8 @@
|
|||||||
<span class="{name(.)}">
|
<span class="{name(.)}">
|
||||||
<xsl:call-template name="person.name" />
|
<xsl:call-template name="person.name" />
|
||||||
<!-- (<xsl:value-of select="affiliation"/>) -->
|
<!-- (<xsl:value-of select="affiliation"/>) -->
|
||||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
<xsl:apply-templates mode="titlepage.mode"
|
||||||
|
select="./contrib" />
|
||||||
</span>
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||||
@ -88,18 +92,20 @@
|
|||||||
<xsl:apply-templates mode="titlepage.mode" />
|
<xsl:apply-templates mode="titlepage.mode" />
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<!--###################################################
|
<!--################################################### Headers and Footers
|
||||||
Headers and Footers
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||||
<xsl:template name="user.header.navigation">
|
<xsl:template name="user.header.navigation">
|
||||||
<div style="background-color:white;border:none;height:73px;border:1px solid black;">
|
<div
|
||||||
|
style="background-color:white;border:none;height:73px;border:1px solid black;">
|
||||||
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
||||||
title="The Spring Framework - Spring Data">
|
title="The Spring Framework - Spring Data">
|
||||||
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
||||||
</a>
|
</a>
|
||||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
<a style="border:none;" href="http://www.SpringSource.com/"
|
||||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
title="SpringSource - Spring from the Source">
|
||||||
|
<img style="border:none;position:absolute;padding-top:5px;right:42px;"
|
||||||
|
src="images/s2-banner-rhs.png" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -1,26 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!-- borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/html_chunk.xsl
|
||||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/xsl/html_chunk.xsl
|
This is the XSL HTML configuration file for the Spring Reference Documentation. -->
|
||||||
This is the XSL HTML configuration file for the Spring Reference Documentation.
|
|
||||||
-->
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<xsl:import href="urn:docbkx:stylesheet" />
|
<xsl:import href="urn:docbkx:stylesheet" />
|
||||||
<xsl:import href="highlight.xsl" />
|
<xsl:import href="highlight.xsl" />
|
||||||
|
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### HTML Settings ################################################### -->
|
||||||
HTML Settings
|
<xsl:param name="chunk.section.depth">
|
||||||
################################################### -->
|
'5'
|
||||||
<xsl:param name="chunk.section.depth">'5'</xsl:param>
|
</xsl:param>
|
||||||
<xsl:param name="use.id.as.filename">'1'</xsl:param>
|
<xsl:param name="use.id.as.filename">
|
||||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
'1'
|
||||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
</xsl:param>
|
||||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
<xsl:param name="tablecolumns.extension">
|
||||||
<!--###################################################
|
0
|
||||||
Table Of Contents
|
</xsl:param>
|
||||||
|
<xsl:param name="graphicsize.extension">
|
||||||
|
0
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="ignore.image.scaling">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
|
<!--################################################### Table Of Contents
|
||||||
################################################### -->
|
################################################### -->
|
||||||
<!-- Generate the TOCs for named components only -->
|
<!-- Generate the TOCs for named components only -->
|
||||||
<xsl:param name="generate.toc">
|
<xsl:param name="generate.toc">
|
||||||
@ -28,31 +32,36 @@
|
|||||||
qandaset toc
|
qandaset toc
|
||||||
</xsl:param>
|
</xsl:param>
|
||||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
<xsl:param name="toc.section.depth">
|
||||||
<!--###################################################
|
3
|
||||||
Labels
|
</xsl:param>
|
||||||
################################################### -->
|
<!--################################################### Labels ################################################### -->
|
||||||
<!-- Label Chapters and Sections (numbering) -->
|
<!-- Label Chapters and Sections (numbering) -->
|
||||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
<xsl:param name="chapter.autolabel">
|
||||||
|
1
|
||||||
|
</xsl:param>
|
||||||
<xsl:param name="section.autolabel" select="1" />
|
<xsl:param name="section.autolabel" select="1" />
|
||||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
<xsl:param name="section.label.includes.component.label"
|
||||||
<!--###################################################
|
select="1" />
|
||||||
Callouts
|
<!--################################################### Callouts ################################################### -->
|
||||||
################################################### -->
|
|
||||||
<!-- Place callout marks at this column in annotated areas -->
|
<!-- Place callout marks at this column in annotated areas -->
|
||||||
<xsl:param name="callout.graphics">1</xsl:param>
|
<xsl:param name="callout.graphics">
|
||||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
1
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="callout.defaultcolumn">
|
||||||
|
90
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<!--###################################################
|
<!--################################################### Admonitions ################################################### -->
|
||||||
Admonitions
|
|
||||||
################################################### -->
|
|
||||||
|
|
||||||
<!-- Use nice graphics for admonitions -->
|
<!-- Use nice graphics for admonitions -->
|
||||||
<xsl:param name="admon.graphics">1</xsl:param>
|
<xsl:param name="admon.graphics">
|
||||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
1
|
||||||
<!--###################################################
|
</xsl:param>
|
||||||
Misc
|
<xsl:param name="admon.graphics.path">
|
||||||
################################################### -->
|
images/admons/
|
||||||
|
</xsl:param>
|
||||||
|
<!--################################################### Misc ################################################### -->
|
||||||
<!-- Placement of titles -->
|
<!-- Placement of titles -->
|
||||||
<xsl:param name="formal.title.placement">
|
<xsl:param name="formal.title.placement">
|
||||||
figure after
|
figure after
|
||||||
@ -67,11 +76,12 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
<span class="{name(.)}">
|
<span class="{name(.)}">
|
||||||
<xsl:call-template name="person.name" />
|
<xsl:call-template name="person.name" />
|
||||||
(<xsl:value-of select="affiliation"/>)
|
(
|
||||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
<xsl:value-of select="affiliation" />
|
||||||
<!--
|
)
|
||||||
<xsl:apply-templates mode="titlepage.mode" select="./affiliation"/>
|
<xsl:apply-templates mode="titlepage.mode"
|
||||||
-->
|
select="./contrib" />
|
||||||
|
<!-- <xsl:apply-templates mode="titlepage.mode" select="./affiliation"/> -->
|
||||||
</span>
|
</span>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||||
@ -81,41 +91,49 @@
|
|||||||
<xsl:apply-templates mode="titlepage.mode" />
|
<xsl:apply-templates mode="titlepage.mode" />
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<!--###################################################
|
<!--################################################### Headers and Footers
|
||||||
Headers and Footers
|
|
||||||
################################################### -->
|
################################################### -->
|
||||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||||
<xsl:template name="user.header.navigation">
|
<xsl:template name="user.header.navigation">
|
||||||
<div style="background-color:white;border:none;height:73px;border:1px solid black;">
|
<div
|
||||||
|
style="background-color:white;border:none;height:73px;border:1px solid black;">
|
||||||
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
||||||
title="The Spring Framework - Spring Data">
|
title="The Spring Framework - Spring Data">
|
||||||
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
||||||
</a>
|
</a>
|
||||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
<a style="border:none;" href="http://www.SpringSource.com/"
|
||||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
title="SpringSource - Spring from the Source">
|
||||||
|
<img style="border:none;position:absolute;padding-top:5px;right:42px;"
|
||||||
|
src="images/s2-banner-rhs.png" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<!-- no other header navigation (prev, next, etc.) -->
|
<!-- no other header navigation (prev, next, etc.) -->
|
||||||
<xsl:template name="header.navigation" />
|
<xsl:template name="header.navigation" />
|
||||||
<xsl:param name="navig.showtitles">1</xsl:param>
|
<xsl:param name="navig.showtitles">
|
||||||
<!-- let's have a 'Sponsored by SpringSource' strapline (or somesuch) across the bottom of each page -->
|
1
|
||||||
|
</xsl:param>
|
||||||
|
<!-- let's have a 'Sponsored by SpringSource' strapline (or somesuch) across
|
||||||
|
the bottom of each page -->
|
||||||
<xsl:template name="footer.navigation">
|
<xsl:template name="footer.navigation">
|
||||||
<xsl:param name="prev" select="/foo" />
|
<xsl:param name="prev" select="/foo" />
|
||||||
<xsl:param name="next" select="/foo" />
|
<xsl:param name="next" select="/foo" />
|
||||||
<xsl:param name="nav.context" />
|
<xsl:param name="nav.context" />
|
||||||
<xsl:variable name="home" select="/*[1]" />
|
<xsl:variable name="home" select="/*[1]" />
|
||||||
<xsl:variable name="up" select="parent::*" />
|
<xsl:variable name="up" select="parent::*" />
|
||||||
<xsl:variable name="row1" select="count($prev) > 0
|
<xsl:variable name="row1"
|
||||||
|
select="count($prev) > 0
|
||||||
or count($up) > 0
|
or count($up) > 0
|
||||||
or count($next) > 0" />
|
or count($next) > 0" />
|
||||||
<xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
|
<xsl:variable name="row2"
|
||||||
|
select="($prev and $navig.showtitles != 0)
|
||||||
or (generate-id($home) != generate-id(.)
|
or (generate-id($home) != generate-id(.)
|
||||||
or $nav.context = 'toc')
|
or $nav.context = 'toc')
|
||||||
or ($chunk.tocs.and.lots != 0
|
or ($chunk.tocs.and.lots != 0
|
||||||
and $nav.context != 'toc')
|
and $nav.context != 'toc')
|
||||||
or ($next and $navig.showtitles != 0)" />
|
or ($next and $navig.showtitles != 0)" />
|
||||||
<xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
|
<xsl:if
|
||||||
|
test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
|
||||||
<div class="navfooter">
|
<div class="navfooter">
|
||||||
<xsl:if test="$footer.rule != 0">
|
<xsl:if test="$footer.rule != 0">
|
||||||
<hr />
|
<hr />
|
||||||
@ -128,8 +146,10 @@
|
|||||||
<xsl:if test="count($prev)>0">
|
<xsl:if test="count($prev)>0">
|
||||||
<a accesskey="p">
|
<a accesskey="p">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:call-template name="href.target">
|
<xsl:call-template
|
||||||
<xsl:with-param name="object" select="$prev"/>
|
name="href.target">
|
||||||
|
<xsl:with-param
|
||||||
|
name="object" select="$prev" />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="navig.content">
|
<xsl:call-template name="navig.content">
|
||||||
@ -145,8 +165,10 @@
|
|||||||
<xsl:when test="$home != . or $nav.context = 'toc'">
|
<xsl:when test="$home != . or $nav.context = 'toc'">
|
||||||
<a accesskey="h">
|
<a accesskey="h">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:call-template name="href.target">
|
<xsl:call-template
|
||||||
<xsl:with-param name="object" select="$home"/>
|
name="href.target">
|
||||||
|
<xsl:with-param
|
||||||
|
name="object" select="$home" />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="navig.content">
|
<xsl:call-template name="navig.content">
|
||||||
@ -157,16 +179,21 @@
|
|||||||
<xsl:text> | </xsl:text>
|
<xsl:text> | </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise> </xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
 
|
||||||
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
||||||
<a accesskey="t">
|
<a accesskey="t">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
|
<xsl:apply-templates
|
||||||
<xsl:with-param name="recursive" select="true()"/>
|
select="/*[1]" mode="recursive-chunk-filename">
|
||||||
|
<xsl:with-param
|
||||||
|
name="recursive" select="true()" />
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:text>-toc</xsl:text>
|
<xsl:text>-toc</xsl:text>
|
||||||
<xsl:value-of select="$html.ext"/>
|
<xsl:value-of
|
||||||
|
select="$html.ext" />
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="gentext">
|
<xsl:call-template name="gentext">
|
||||||
<xsl:with-param name="key" select="'nav-toc'" />
|
<xsl:with-param name="key" select="'nav-toc'" />
|
||||||
@ -179,8 +206,10 @@
|
|||||||
<xsl:if test="count($next)>0">
|
<xsl:if test="count($next)>0">
|
||||||
<a accesskey="n">
|
<a accesskey="n">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:call-template name="href.target">
|
<xsl:call-template
|
||||||
<xsl:with-param name="object" select="$next"/>
|
name="href.target">
|
||||||
|
<xsl:with-param
|
||||||
|
name="object" select="$next" />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="navig.content">
|
<xsl:call-template name="navig.content">
|
||||||
@ -195,21 +224,23 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td width="40%" align="left" valign="top">
|
<td width="40%" align="left" valign="top">
|
||||||
<xsl:if test="$navig.showtitles != 0">
|
<xsl:if test="$navig.showtitles != 0">
|
||||||
<xsl:apply-templates select="$prev" mode="object.title.markup"/>
|
<xsl:apply-templates select="$prev"
|
||||||
|
mode="object.title.markup" />
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</td>
|
</td>
|
||||||
<td width="20%" align="center">
|
<td width="20%" align="center">
|
||||||
<span style="color:white;font-size:90%;">
|
<span style="color:white;font-size:90%;">
|
||||||
<a href="http://www.SpringSource.com/"
|
<a href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">Sponsored by
|
||||||
title="SpringSource - Spring from the Source">Sponsored by SpringSource
|
SpringSource
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td width="40%" align="right" valign="top">
|
<td width="40%" align="right" valign="top">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:if test="$navig.showtitles != 0">
|
<xsl:if test="$navig.showtitles != 0">
|
||||||
<xsl:apply-templates select="$next" mode="object.title.markup"/>
|
<xsl:apply-templates select="$next"
|
||||||
|
mode="object.title.markup" />
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<assembly>
|
<assembly>
|
||||||
<!-- distribution assembly descriptor. packages up jars, source jars, documentation,
|
<!-- distribution assembly descriptor. packages up jars, source jars, documentation,
|
||||||
dependencies and other resources into a single archive suitable for download and
|
dependencies and other resources into a single archive suitable for download
|
||||||
standalone use.
|
and standalone use. see pom.xml 'maven-assembly-plugin' declaration see src/main/scripts/build-distribution.sh
|
||||||
see pom.xml 'maven-assembly-plugin' declaration
|
|
||||||
see src/main/scripts/build-distribution.sh
|
|
||||||
see http://www.sonatype.com/books/mvnref-book/reference/assemblies-set-dist-assemblies.html -->
|
see http://www.sonatype.com/books/mvnref-book/reference/assemblies-set-dist-assemblies.html -->
|
||||||
<id>distribution</id>
|
<id>distribution</id>
|
||||||
<formats>
|
<formats>
|
||||||
@ -24,15 +22,14 @@
|
|||||||
<lineEnding>dos</lineEnding>
|
<lineEnding>dos</lineEnding>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<!-- adds reference manual (html and pdf) to the distribution archive under the
|
<!-- adds reference manual (html and pdf) to the distribution archive
|
||||||
'docs/reference' directory
|
under the 'docs/reference' directory see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||||
see pom.xml 'maven-javadoc-plugin' declaration -->
|
|
||||||
<directory>target/site/reference</directory>
|
<directory>target/site/reference</directory>
|
||||||
<outputDirectory>docs/reference</outputDirectory>
|
<outputDirectory>docs/reference</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<!-- adds javadoc html to the distribution archive under the 'docs/javadoc' directory
|
<!-- adds javadoc html to the distribution archive under the 'docs/javadoc'
|
||||||
see pom.xml 'maven-javadoc-plugin' declaration -->
|
directory see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||||
<directory>target/site/apidocs</directory>
|
<directory>target/site/apidocs</directory>
|
||||||
<outputDirectory>docs/javadoc</outputDirectory>
|
<outputDirectory>docs/javadoc</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
<id>all</id>
|
<id>all</id>
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.annotations;
|
package org.springframework.data.elasticsearch.annotations;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.annotation.Persistent;
|
import org.springframework.data.annotation.Persistent;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
@ -34,9 +33,14 @@ import java.lang.annotation.*;
|
|||||||
public @interface Document {
|
public @interface Document {
|
||||||
|
|
||||||
String indexName();
|
String indexName();
|
||||||
|
|
||||||
String type() default "";
|
String type() default "";
|
||||||
|
|
||||||
short shards() default 1;
|
short shards() default 1;
|
||||||
|
|
||||||
short replicas() default 5;
|
short replicas() default 5;
|
||||||
|
|
||||||
String refreshInterval() default "1s";
|
String refreshInterval() default "1s";
|
||||||
|
|
||||||
String indexStoreType() default "fs";
|
String indexStoreType() default "fs";
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ package org.springframework.data.elasticsearch.annotations;
|
|||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -28,9 +27,13 @@ import java.lang.annotation.*;
|
|||||||
public @interface Field {
|
public @interface Field {
|
||||||
|
|
||||||
String type() default "";
|
String type() default "";
|
||||||
|
|
||||||
String index() default "";
|
String index() default "";
|
||||||
|
|
||||||
boolean store() default false;
|
boolean store() default false;
|
||||||
|
|
||||||
String searchAnalyzer() default "";
|
String searchAnalyzer() default "";
|
||||||
|
|
||||||
String indexAnalyzer() default "";
|
String indexAnalyzer() default "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,11 +65,11 @@ public class NodeClientFactoryBean implements FactoryBean<NodeClient>, Initializ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder().put("http.enabled",
|
||||||
.put("http.enabled", String.valueOf(this.enableHttp));
|
String.valueOf(this.enableHttp));
|
||||||
|
|
||||||
nodeClient = (NodeClient) nodeBuilder().settings(settings)
|
nodeClient = (NodeClient) nodeBuilder().settings(settings).clusterName(this.clusterName).local(this.local).node()
|
||||||
.clusterName(this.clusterName).local(this.local).node().client();
|
.client();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocal(boolean local) {
|
public void setLocal(boolean local) {
|
||||||
|
@ -96,8 +96,7 @@ public class TransportClientFactoryBean implements FactoryBean<TransportClient>,
|
|||||||
if (properties != null) {
|
if (properties != null) {
|
||||||
return settingsBuilder().put(properties).build();
|
return settingsBuilder().put(properties).build();
|
||||||
}
|
}
|
||||||
return settingsBuilder()
|
return settingsBuilder().put("client.transport.sniff", true).build();
|
||||||
.put("client.transport.sniff",true).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClusterNodes(String[] clusterNodes) {
|
public void setClusterNodes(String[] clusterNodes) {
|
||||||
|
@ -45,7 +45,6 @@ public class NodeClientBeanDefinitionParser extends AbstractBeanDefinitionParser
|
|||||||
builder.addPropertyValue("enableHttp", Boolean.valueOf(element.getAttribute("http-enabled")));
|
builder.addPropertyValue("enableHttp", Boolean.valueOf(element.getAttribute("http-enabled")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
|
private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
|
||||||
ParserContext context) {
|
ParserContext context) {
|
||||||
AbstractBeanDefinition definition = builder.getBeanDefinition();
|
AbstractBeanDefinition definition = builder.getBeanDefinition();
|
||||||
|
@ -23,6 +23,7 @@ import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import static org.apache.commons.lang.StringUtils.split;
|
import static org.apache.commons.lang.StringUtils.split;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransportClientBeanDefinitionParser
|
* TransportClientBeanDefinitionParser
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,6 @@ import static org.springframework.data.elasticsearch.core.query.Criteria.Operati
|
|||||||
*/
|
*/
|
||||||
class CriteriaQueryProcessor {
|
class CriteriaQueryProcessor {
|
||||||
|
|
||||||
|
|
||||||
QueryBuilder createQueryFromCriteria(Criteria criteria) {
|
QueryBuilder createQueryFromCriteria(Criteria criteria) {
|
||||||
BoolQueryBuilder query = boolQuery();
|
BoolQueryBuilder query = boolQuery();
|
||||||
|
|
||||||
@ -53,7 +52,6 @@ class CriteriaQueryProcessor {
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private QueryBuilder createQueryFragmentForCriteria(Criteria chainedCriteria) {
|
private QueryBuilder createQueryFragmentForCriteria(Criteria chainedCriteria) {
|
||||||
Iterator<Criteria.CriteriaEntry> it = chainedCriteria.getCriteriaEntries().iterator();
|
Iterator<Criteria.CriteriaEntry> it = chainedCriteria.getCriteriaEntries().iterator();
|
||||||
boolean singeEntryCriteria = (chainedCriteria.getCriteriaEntries().size() == 1);
|
boolean singeEntryCriteria = (chainedCriteria.getCriteriaEntries().size() == 1);
|
||||||
@ -77,7 +75,6 @@ class CriteriaQueryProcessor {
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String fieldName) {
|
private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String fieldName) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -86,20 +83,27 @@ class CriteriaQueryProcessor {
|
|||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case EQUALS:
|
case EQUALS:
|
||||||
query = fieldQuery(fieldName, value); break;
|
query = fieldQuery(fieldName, value);
|
||||||
|
break;
|
||||||
case CONTAINS:
|
case CONTAINS:
|
||||||
query = fieldQuery(fieldName,"*" + value + "*").analyzeWildcard(true); break;
|
query = fieldQuery(fieldName, "*" + value + "*").analyzeWildcard(true);
|
||||||
|
break;
|
||||||
case STARTS_WITH:
|
case STARTS_WITH:
|
||||||
query = fieldQuery(fieldName,value +"*").analyzeWildcard(true); break;
|
query = fieldQuery(fieldName, value + "*").analyzeWildcard(true);
|
||||||
|
break;
|
||||||
case ENDS_WITH:
|
case ENDS_WITH:
|
||||||
query = fieldQuery(fieldName, "*"+value).analyzeWildcard(true); break;
|
query = fieldQuery(fieldName, "*" + value).analyzeWildcard(true);
|
||||||
|
break;
|
||||||
case EXPRESSION:
|
case EXPRESSION:
|
||||||
query = queryString((String)value).field(fieldName); break;
|
query = queryString((String) value).field(fieldName);
|
||||||
|
break;
|
||||||
case BETWEEN:
|
case BETWEEN:
|
||||||
Object[] ranges = (Object[]) value;
|
Object[] ranges = (Object[]) value;
|
||||||
query = rangeQuery(fieldName).from(ranges[0]).to(ranges[1]); break;
|
query = rangeQuery(fieldName).from(ranges[0]).to(ranges[1]);
|
||||||
|
break;
|
||||||
case FUZZY:
|
case FUZZY:
|
||||||
query = fuzzyQuery(fieldName, (String) value); break;
|
query = fuzzyQuery(fieldName, (String) value);
|
||||||
|
break;
|
||||||
case IN:
|
case IN:
|
||||||
query = boolQuery();
|
query = boolQuery();
|
||||||
Iterable<Object> collection = (Iterable<Object>) value;
|
Iterable<Object> collection = (Iterable<Object>) value;
|
||||||
@ -130,5 +134,4 @@ class CriteriaQueryProcessor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core;
|
package org.springframework.data.elasticsearch.core;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
|
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
|
||||||
import org.springframework.data.elasticsearch.core.query.*;
|
import org.springframework.data.elasticsearch.core.query.*;
|
||||||
@ -30,7 +29,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ElasticsearchOperations {
|
public interface ElasticsearchOperations {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Converter in use
|
* @return Converter in use
|
||||||
*/
|
*/
|
||||||
@ -38,6 +36,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an index for a class
|
* Create an index for a class
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
@ -45,12 +44,12 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create mapping for a class
|
* Create mapping for a class
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
<T> boolean putMapping(Class<T> clazz);
|
<T> boolean putMapping(Class<T> clazz);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return the first returned object
|
* Execute the query against elasticsearch and return the first returned object
|
||||||
*
|
*
|
||||||
@ -69,7 +68,6 @@ public interface ElasticsearchOperations {
|
|||||||
*/
|
*/
|
||||||
<T> T queryForObject(CriteriaQuery query, Class<T> clazz);
|
<T> T queryForObject(CriteriaQuery query, Class<T> clazz);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return the first returned object
|
* Execute the query against elasticsearch and return the first returned object
|
||||||
*
|
*
|
||||||
@ -79,7 +77,6 @@ public interface ElasticsearchOperations {
|
|||||||
*/
|
*/
|
||||||
<T> T queryForObject(StringQuery query, Class<T> clazz);
|
<T> T queryForObject(StringQuery query, Class<T> clazz);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return result as {@link Page}
|
* Execute the query against elasticsearch and return result as {@link Page}
|
||||||
*
|
*
|
||||||
@ -89,7 +86,6 @@ public interface ElasticsearchOperations {
|
|||||||
*/
|
*/
|
||||||
<T> Page<T> queryForPage(SearchQuery query, Class<T> clazz);
|
<T> Page<T> queryForPage(SearchQuery query, Class<T> clazz);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return result as {@link Page}
|
* Execute the query against elasticsearch and return result as {@link Page}
|
||||||
*
|
*
|
||||||
@ -99,7 +95,6 @@ public interface ElasticsearchOperations {
|
|||||||
*/
|
*/
|
||||||
<T> Page<T> queryForPage(SearchQuery query, ResultsMapper<T> resultsMapper);
|
<T> Page<T> queryForPage(SearchQuery query, ResultsMapper<T> resultsMapper);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return result as {@link Page}
|
* Execute the query against elasticsearch and return result as {@link Page}
|
||||||
*
|
*
|
||||||
@ -109,7 +104,6 @@ public interface ElasticsearchOperations {
|
|||||||
*/
|
*/
|
||||||
<T> Page<T> queryForPage(CriteriaQuery query, Class<T> clazz);
|
<T> Page<T> queryForPage(CriteriaQuery query, Class<T> clazz);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query against elasticsearch and return result as {@link Page}
|
* Execute the query against elasticsearch and return result as {@link Page}
|
||||||
*
|
*
|
||||||
@ -192,6 +186,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all records matching the query
|
* Delete all records matching the query
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param query
|
* @param query
|
||||||
*/
|
*/
|
||||||
@ -199,6 +194,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an index for given entity
|
* Deletes an index for given entity
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @return
|
* @return
|
||||||
@ -207,6 +203,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* check if index is exists
|
* check if index is exists
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @return
|
* @return
|
||||||
@ -215,6 +212,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh the index
|
* refresh the index
|
||||||
|
*
|
||||||
* @param indexName
|
* @param indexName
|
||||||
* @param waitForOperation
|
* @param waitForOperation
|
||||||
*/
|
*/
|
||||||
@ -222,6 +220,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh the index
|
* refresh the index
|
||||||
|
*
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param waitForOperation
|
* @param waitForOperation
|
||||||
*/
|
*/
|
||||||
@ -229,6 +228,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns scroll id for scan query
|
* Returns scroll id for scan query
|
||||||
|
*
|
||||||
* @param query
|
* @param query
|
||||||
* @param scrollTimeInMillis
|
* @param scrollTimeInMillis
|
||||||
* @param noFields
|
* @param noFields
|
||||||
@ -238,6 +238,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls the results for give scroll id
|
* Scrolls the results for give scroll id
|
||||||
|
*
|
||||||
* @param scrollId
|
* @param scrollId
|
||||||
* @param scrollTimeInMillis
|
* @param scrollTimeInMillis
|
||||||
* @param resultsMapper
|
* @param resultsMapper
|
||||||
@ -248,6 +249,7 @@ public interface ElasticsearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* more like this query to search for documents that are "like" a specific document.
|
* more like this query to search for documents that are "like" a specific document.
|
||||||
|
*
|
||||||
* @param query
|
* @param query
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
@ -90,7 +90,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter) {
|
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.elasticsearchConverter = (elasticsearchConverter == null)? new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()) : elasticsearchConverter ;
|
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
|
||||||
|
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -102,11 +103,12 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
@Override
|
@Override
|
||||||
public <T> boolean putMapping(Class<T> clazz) {
|
public <T> boolean putMapping(Class<T> clazz) {
|
||||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||||
PutMappingRequestBuilder requestBuilder = client.admin().indices().preparePutMapping(persistentEntity.getIndexName())
|
PutMappingRequestBuilder requestBuilder = client.admin().indices()
|
||||||
.setType(persistentEntity.getIndexType());
|
.preparePutMapping(persistentEntity.getIndexName()).setType(persistentEntity.getIndexType());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
XContentBuilder xContentBuilder = buildMapping(clazz, persistentEntity.getIndexType(), persistentEntity.getIdProperty().getFieldName());
|
XContentBuilder xContentBuilder = buildMapping(clazz, persistentEntity.getIndexType(), persistentEntity
|
||||||
|
.getIdProperty().getFieldName());
|
||||||
return requestBuilder.setSource(xContentBuilder).execute().actionGet().isAcknowledged();
|
return requestBuilder.setSource(xContentBuilder).execute().actionGet().isAcknowledged();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ElasticsearchException("Failed to build mapping for " + clazz.getSimpleName(), e);
|
throw new ElasticsearchException("Failed to build mapping for " + clazz.getSimpleName(), e);
|
||||||
@ -121,8 +123,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
@Override
|
@Override
|
||||||
public <T> T queryForObject(GetQuery query, Class<T> clazz) {
|
public <T> T queryForObject(GetQuery query, Class<T> clazz) {
|
||||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||||
GetResponse response = client.prepareGet(persistentEntity.getIndexName(), persistentEntity.getIndexType(), query.getId())
|
GetResponse response = client
|
||||||
.execute().actionGet();
|
.prepareGet(persistentEntity.getIndexName(), persistentEntity.getIndexType(), query.getId()).execute()
|
||||||
|
.actionGet();
|
||||||
return mapResult(response.getSourceAsString(), clazz);
|
return mapResult(response.getSourceAsString(), clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,13 +145,15 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Page<T> queryForPage(SearchQuery query, Class<T> clazz) {
|
public <T> Page<T> queryForPage(SearchQuery query, Class<T> clazz) {
|
||||||
SearchResponse response = doSearch(prepareSearch(query,clazz), query.getQuery(), query.getFilter(), query.getElasticsearchSort());
|
SearchResponse response = doSearch(prepareSearch(query, clazz), query.getQuery(), query.getFilter(),
|
||||||
|
query.getElasticsearchSort());
|
||||||
return mapResults(response, clazz, query.getPageable());
|
return mapResults(response, clazz, query.getPageable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Page<T> queryForPage(SearchQuery query, ResultsMapper<T> resultsMapper) {
|
public <T> Page<T> queryForPage(SearchQuery query, ResultsMapper<T> resultsMapper) {
|
||||||
SearchResponse response = doSearch(prepareSearch(query), query.getQuery(), query.getFilter(), query.getElasticsearchSort());
|
SearchResponse response = doSearch(prepareSearch(query), query.getQuery(), query.getFilter(),
|
||||||
|
query.getElasticsearchSort());
|
||||||
return resultsMapper.mapResults(response);
|
return resultsMapper.mapResults(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,11 +167,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
return queryForPage(query, clazz).getContent();
|
return queryForPage(query, clazz).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> List<String> queryForIds(SearchQuery query) {
|
public <T> List<String> queryForIds(SearchQuery query) {
|
||||||
SearchRequestBuilder request = prepareSearch(query).setQuery(query.getQuery())
|
SearchRequestBuilder request = prepareSearch(query).setQuery(query.getQuery()).setNoFields();
|
||||||
.setNoFields();
|
|
||||||
if (query.getFilter() != null) {
|
if (query.getFilter() != null) {
|
||||||
request.setFilter(query.getFilter());
|
request.setFilter(query.getFilter());
|
||||||
}
|
}
|
||||||
@ -177,25 +180,21 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
@Override
|
@Override
|
||||||
public <T> Page<T> queryForPage(CriteriaQuery criteriaQuery, Class<T> clazz) {
|
public <T> Page<T> queryForPage(CriteriaQuery criteriaQuery, Class<T> clazz) {
|
||||||
QueryBuilder query = new CriteriaQueryProcessor().createQueryFromCriteria(criteriaQuery.getCriteria());
|
QueryBuilder query = new CriteriaQueryProcessor().createQueryFromCriteria(criteriaQuery.getCriteria());
|
||||||
SearchResponse response = prepareSearch(criteriaQuery,clazz)
|
SearchResponse response = prepareSearch(criteriaQuery, clazz).setQuery(query).execute().actionGet();
|
||||||
.setQuery(query)
|
|
||||||
.execute().actionGet();
|
|
||||||
return mapResults(response, clazz, criteriaQuery.getPageable());
|
return mapResults(response, clazz, criteriaQuery.getPageable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Page<T> queryForPage(StringQuery query, Class<T> clazz) {
|
public <T> Page<T> queryForPage(StringQuery query, Class<T> clazz) {
|
||||||
SearchResponse response = prepareSearch(query,clazz)
|
SearchResponse response = prepareSearch(query, clazz).setQuery(query.getSource()).execute().actionGet();
|
||||||
.setQuery(query.getSource())
|
|
||||||
.execute().actionGet();
|
|
||||||
return mapResults(response, clazz, query.getPageable());
|
return mapResults(response, clazz, query.getPageable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> long count(SearchQuery query, Class<T> clazz) {
|
public <T> long count(SearchQuery query, Class<T> clazz) {
|
||||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||||
CountRequestBuilder countRequestBuilder = client.prepareCount(persistentEntity.getIndexName())
|
CountRequestBuilder countRequestBuilder = client.prepareCount(persistentEntity.getIndexName()).setTypes(
|
||||||
.setTypes(persistentEntity.getIndexType());
|
persistentEntity.getIndexType());
|
||||||
if (query.getQuery() != null) {
|
if (query.getQuery() != null) {
|
||||||
countRequestBuilder.setQuery(query.getQuery());
|
countRequestBuilder.setQuery(query.getQuery());
|
||||||
}
|
}
|
||||||
@ -204,9 +203,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String index(IndexQuery query) {
|
public String index(IndexQuery query) {
|
||||||
return prepareIndex(query)
|
return prepareIndex(query).execute().actionGet().getId();
|
||||||
.execute()
|
|
||||||
.actionGet().getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -222,7 +219,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
if (item.isFailed())
|
if (item.isFailed())
|
||||||
failedDocuments.put(item.getId(), item.getFailureMessage());
|
failedDocuments.put(item.getId(), item.getFailureMessage());
|
||||||
}
|
}
|
||||||
throw new ElasticsearchException("Bulk indexing has failures. Use ElasticsearchException.getFailedDocuments() for detailed messages [" + failedDocuments+"]", failedDocuments);
|
throw new ElasticsearchException(
|
||||||
|
"Bulk indexing has failures. Use ElasticsearchException.getFailedDocuments() for detailed messages ["
|
||||||
|
+ failedDocuments + "]", failedDocuments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,8 +241,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String delete(String indexName, String type, String id) {
|
public String delete(String indexName, String type, String id) {
|
||||||
return client.prepareDelete(indexName, type, id)
|
return client.prepareDelete(indexName, type, id).execute().actionGet().getId();
|
||||||
.execute().actionGet().getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -255,10 +253,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
@Override
|
@Override
|
||||||
public <T> void delete(DeleteQuery deleteQuery, Class<T> clazz) {
|
public <T> void delete(DeleteQuery deleteQuery, Class<T> clazz) {
|
||||||
ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz);
|
ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz);
|
||||||
client.prepareDeleteByQuery(persistentEntity.getIndexName())
|
client.prepareDeleteByQuery(persistentEntity.getIndexName()).setTypes(persistentEntity.getIndexType())
|
||||||
.setTypes(persistentEntity.getIndexType())
|
.setQuery(deleteQuery.getQuery()).execute().actionGet();
|
||||||
.setQuery(deleteQuery.getQuery())
|
|
||||||
.execute().actionGet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -267,12 +263,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
Assert.notNull(searchQuery.getTypes(), "No type define for Query");
|
Assert.notNull(searchQuery.getTypes(), "No type define for Query");
|
||||||
Assert.notNull(searchQuery.getPageable(), "Query.pageable is required for scan & scroll");
|
Assert.notNull(searchQuery.getPageable(), "Query.pageable is required for scan & scroll");
|
||||||
|
|
||||||
SearchRequestBuilder requestBuilder = client.prepareSearch(toArray(searchQuery.getIndices()))
|
SearchRequestBuilder requestBuilder = client.prepareSearch(toArray(searchQuery.getIndices())).setSearchType(SCAN)
|
||||||
.setSearchType(SCAN)
|
.setQuery(searchQuery.getQuery()).setTypes(toArray(searchQuery.getTypes()))
|
||||||
.setQuery(searchQuery.getQuery())
|
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis)).setFrom(0)
|
||||||
.setTypes(toArray(searchQuery.getTypes()))
|
|
||||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis))
|
|
||||||
.setFrom(0)
|
|
||||||
.setSize(searchQuery.getPageable().getPageSize());
|
.setSize(searchQuery.getPageable().getPageSize());
|
||||||
|
|
||||||
if (searchQuery.getFilter() != null) {
|
if (searchQuery.getFilter() != null) {
|
||||||
@ -288,8 +281,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
@Override
|
@Override
|
||||||
public <T> Page<T> scroll(String scrollId, long scrollTimeInMillis, ResultsMapper<T> resultsMapper) {
|
public <T> Page<T> scroll(String scrollId, long scrollTimeInMillis, ResultsMapper<T> resultsMapper) {
|
||||||
SearchResponse response = client.prepareSearchScroll(scrollId)
|
SearchResponse response = client.prepareSearchScroll(scrollId)
|
||||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis))
|
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis)).execute().actionGet();
|
||||||
.execute().actionGet();
|
|
||||||
return resultsMapper.mapResults(response);
|
return resultsMapper.mapResults(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,8 +296,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
Assert.notNull(type, "No 'type' defined for MoreLikeThisQuery");
|
Assert.notNull(type, "No 'type' defined for MoreLikeThisQuery");
|
||||||
Assert.notNull(query.getId(), "No document id defined for MoreLikeThisQuery");
|
Assert.notNull(query.getId(), "No document id defined for MoreLikeThisQuery");
|
||||||
|
|
||||||
MoreLikeThisRequestBuilder requestBuilder =
|
MoreLikeThisRequestBuilder requestBuilder = client.prepareMoreLikeThis(indexName, type, query.getId());
|
||||||
client.prepareMoreLikeThis(indexName,type, query.getId());
|
|
||||||
|
|
||||||
if (query.getPageable() != null) {
|
if (query.getPageable() != null) {
|
||||||
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
||||||
@ -357,7 +348,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
return mapResults(response, clazz, query.getPageable());
|
return mapResults(response, clazz, query.getPageable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchResponse doSearch(SearchRequestBuilder searchRequest, QueryBuilder query, FilterBuilder filter, SortBuilder sortBuilder){
|
private SearchResponse doSearch(SearchRequestBuilder searchRequest, QueryBuilder query, FilterBuilder filter,
|
||||||
|
SortBuilder sortBuilder) {
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
searchRequest.setFilter(filter);
|
searchRequest.setFilter(filter);
|
||||||
}
|
}
|
||||||
@ -374,24 +366,21 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean indexExists(String indexName) {
|
private boolean indexExists(String indexName) {
|
||||||
return client.admin()
|
return client.admin().indices().exists(indicesExistsRequest(indexName)).actionGet().isExists();
|
||||||
.indices()
|
|
||||||
.exists(indicesExistsRequest(indexName)).actionGet().isExists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> boolean createIndexWithSettings(Class<T> clazz) {
|
private <T> boolean createIndexWithSettings(Class<T> clazz) {
|
||||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||||
return client.admin().indices().create(Requests.createIndexRequest(persistentEntity.getIndexName()).
|
return client.admin().indices()
|
||||||
settings(getSettings(persistentEntity))).actionGet().isAcknowledged();
|
.create(Requests.createIndexRequest(persistentEntity.getIndexName()).settings(getSettings(persistentEntity)))
|
||||||
|
.actionGet().isAcknowledged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> Map getSettings(ElasticsearchPersistentEntity<T> persistentEntity) {
|
private <T> Map getSettings(ElasticsearchPersistentEntity<T> persistentEntity) {
|
||||||
return new MapBuilder<String, String>()
|
return new MapBuilder<String, String>().put("index.number_of_shards", String.valueOf(persistentEntity.getShards()))
|
||||||
.put("index.number_of_shards", String.valueOf(persistentEntity.getShards()))
|
|
||||||
.put("index.number_of_replicas", String.valueOf(persistentEntity.getReplicas()))
|
.put("index.number_of_replicas", String.valueOf(persistentEntity.getReplicas()))
|
||||||
.put("index.refresh_interval", persistentEntity.getRefreshInterval())
|
.put("index.refresh_interval", persistentEntity.getRefreshInterval())
|
||||||
.put("index.store.type", persistentEntity.getIndexStoreType())
|
.put("index.store.type", persistentEntity.getIndexStoreType()).map();
|
||||||
.map();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> SearchRequestBuilder prepareSearch(Query query, Class<T> clazz) {
|
private <T> SearchRequestBuilder prepareSearch(Query query, Class<T> clazz) {
|
||||||
@ -410,8 +399,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
int startRecord = 0;
|
int startRecord = 0;
|
||||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(toArray(query.getIndices()))
|
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(toArray(query.getIndices()))
|
||||||
.setSearchType(DFS_QUERY_THEN_FETCH)
|
.setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
|
||||||
.setTypes(toArray(query.getTypes()));
|
|
||||||
|
|
||||||
if (query.getPageable() != null) {
|
if (query.getPageable() != null) {
|
||||||
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
||||||
@ -419,14 +407,14 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
}
|
}
|
||||||
searchRequestBuilder.setFrom(startRecord);
|
searchRequestBuilder.setFrom(startRecord);
|
||||||
|
|
||||||
|
|
||||||
if (!query.getFields().isEmpty()) {
|
if (!query.getFields().isEmpty()) {
|
||||||
searchRequestBuilder.addFields(toArray(query.getFields()));
|
searchRequestBuilder.addFields(toArray(query.getFields()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.getSort() != null) {
|
if (query.getSort() != null) {
|
||||||
for (Sort.Order order : query.getSort()) {
|
for (Sort.Order order : query.getSort()) {
|
||||||
searchRequestBuilder.addSort(order.getProperty(), order.getDirection() == Sort.Direction.DESC? SortOrder.DESC : SortOrder.ASC);
|
searchRequestBuilder.addSort(order.getProperty(), order.getDirection() == Sort.Direction.DESC ? SortOrder.DESC
|
||||||
|
: SortOrder.ASC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return searchRequestBuilder;
|
return searchRequestBuilder;
|
||||||
@ -434,13 +422,13 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
|
|
||||||
private IndexRequestBuilder prepareIndex(IndexQuery query) {
|
private IndexRequestBuilder prepareIndex(IndexQuery query) {
|
||||||
try {
|
try {
|
||||||
String indexName = isBlank(query.getIndexName())?
|
String indexName = isBlank(query.getIndexName()) ? retrieveIndexNameFromPersistentEntity(query.getObject()
|
||||||
retrieveIndexNameFromPersistentEntity(query.getObject().getClass())[0] : query.getIndexName();
|
.getClass())[0] : query.getIndexName();
|
||||||
String type = isBlank(query.getType())?
|
String type = isBlank(query.getType()) ? retrieveTypeFromPersistentEntity(query.getObject().getClass())[0]
|
||||||
retrieveTypeFromPersistentEntity(query.getObject().getClass())[0] : query.getType();
|
: query.getType();
|
||||||
|
|
||||||
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(indexName,type,query.getId())
|
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(indexName, type, query.getId()).setSource(
|
||||||
.setSource(objectMapper.writeValueAsString(query.getObject()));
|
objectMapper.writeValueAsString(query.getObject()));
|
||||||
|
|
||||||
if (query.getVersion() != null) {
|
if (query.getVersion() != null) {
|
||||||
indexRequestBuilder.setVersion(query.getVersion());
|
indexRequestBuilder.setVersion(query.getVersion());
|
||||||
@ -453,8 +441,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refresh(String indexName, boolean waitForOperation) {
|
public void refresh(String indexName, boolean waitForOperation) {
|
||||||
client.admin().indices()
|
client.admin().indices().refresh(refreshRequest(indexName).waitForOperations(waitForOperation)).actionGet();
|
||||||
.refresh(refreshRequest(indexName).waitForOperations(waitForOperation)).actionGet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void refresh(Class<T> clazz, boolean waitForOperation) {
|
public <T> void refresh(Class<T> clazz, boolean waitForOperation) {
|
||||||
@ -464,8 +451,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ElasticsearchPersistentEntity getPersistentEntityFor(Class clazz) {
|
private ElasticsearchPersistentEntity getPersistentEntityFor(Class clazz) {
|
||||||
Assert.isTrue(clazz.isAnnotationPresent(Document.class), "Unable to identify index name. " +
|
Assert.isTrue(clazz.isAnnotationPresent(Document.class), "Unable to identify index name. " + clazz.getSimpleName()
|
||||||
clazz.getSimpleName() + " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")");
|
+ " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")");
|
||||||
return elasticsearchConverter.getMappingContext().getPersistentEntity(clazz);
|
return elasticsearchConverter.getMappingContext().getPersistentEntity(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,4 +509,3 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core;
|
package org.springframework.data.elasticsearch.core;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.springframework.data.elasticsearch.annotations.Field;
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||||
@ -39,26 +38,20 @@ class MappingBuilder {
|
|||||||
private static SimpleTypeHolder SIMPLE_TYPE_HOLDER = new SimpleTypeHolder();
|
private static SimpleTypeHolder SIMPLE_TYPE_HOLDER = new SimpleTypeHolder();
|
||||||
|
|
||||||
static XContentBuilder buildMapping(Class clazz, String indexType, String idFieldName) throws IOException {
|
static XContentBuilder buildMapping(Class clazz, String indexType, String idFieldName) throws IOException {
|
||||||
XContentBuilder xContentBuilder = jsonBuilder()
|
XContentBuilder xContentBuilder = jsonBuilder().startObject().startObject(indexType).startObject("properties");
|
||||||
.startObject().startObject(indexType).startObject("properties");
|
|
||||||
|
|
||||||
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY);
|
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY);
|
||||||
|
|
||||||
return xContentBuilder.endObject().endObject().endObject();
|
return xContentBuilder.endObject().endObject().endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mapEntity(XContentBuilder xContentBuilder,
|
private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, boolean isRootObject, String idFieldName,
|
||||||
Class clazz,
|
|
||||||
boolean isRootObject,
|
|
||||||
String idFieldName,
|
|
||||||
String nestedObjectFieldName) throws IOException {
|
String nestedObjectFieldName) throws IOException {
|
||||||
|
|
||||||
java.lang.reflect.Field[] fields = clazz.getDeclaredFields();
|
java.lang.reflect.Field[] fields = clazz.getDeclaredFields();
|
||||||
|
|
||||||
if (!isRootObject && isAnyPropertyAnnotatedAsField(fields)) {
|
if (!isRootObject && isAnyPropertyAnnotatedAsField(fields)) {
|
||||||
xContentBuilder.startObject(nestedObjectFieldName)
|
xContentBuilder.startObject(nestedObjectFieldName).field("type", "object").startObject("properties");
|
||||||
.field("type", "object")
|
|
||||||
.startObject("properties");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (java.lang.reflect.Field field : fields) {
|
for (java.lang.reflect.Field field : fields) {
|
||||||
@ -79,15 +72,12 @@ class MappingBuilder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyDefaultIdFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field) throws IOException {
|
private static void applyDefaultIdFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field)
|
||||||
xContentBuilder.startObject(field.getName())
|
throws IOException {
|
||||||
.field("type", "string")
|
xContentBuilder.startObject(field.getName()).field("type", "string").field("index", "not_analyzed").endObject();
|
||||||
.field("index", "not_analyzed")
|
|
||||||
.endObject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyFieldAnnotationMapping(XContentBuilder xContentBuilder,
|
private static void applyFieldAnnotationMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field,
|
||||||
java.lang.reflect.Field field,
|
|
||||||
Field fieldAnnotation) throws IOException {
|
Field fieldAnnotation) throws IOException {
|
||||||
xContentBuilder.startObject(field.getName());
|
xContentBuilder.startObject(field.getName());
|
||||||
xContentBuilder.field("store", fieldAnnotation.store());
|
xContentBuilder.field("store", fieldAnnotation.store());
|
||||||
|
@ -20,6 +20,7 @@ import org.springframework.data.domain.Page;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultsMapper
|
* ResultsMapper
|
||||||
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
|
@ -41,7 +41,8 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
public MappingElasticsearchConverter(MappingContext<? extends ElasticsearchPersistentEntity<?>,ElasticsearchPersistentProperty> mappingContext) {
|
public MappingElasticsearchConverter(
|
||||||
|
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
|
||||||
Assert.notNull(mappingContext);
|
Assert.notNull(mappingContext);
|
||||||
this.mappingContext = mappingContext;
|
this.mappingContext = mappingContext;
|
||||||
this.conversionService = new DefaultConversionService();
|
this.conversionService = new DefaultConversionService();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package org.springframework.data.elasticsearch.core.mapping;
|
package org.springframework.data.elasticsearch.core.mapping;
|
||||||
|
|
||||||
import org.springframework.data.mapping.PersistentEntity;
|
import org.springframework.data.mapping.PersistentEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElasticsearchPersistentEntity
|
* ElasticsearchPersistentEntity
|
||||||
*
|
*
|
||||||
@ -26,10 +27,16 @@ import org.springframework.data.mapping.PersistentEntity;
|
|||||||
public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, ElasticsearchPersistentProperty> {
|
public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, ElasticsearchPersistentProperty> {
|
||||||
|
|
||||||
String getIndexName();
|
String getIndexName();
|
||||||
|
|
||||||
String getIndexType();
|
String getIndexType();
|
||||||
|
|
||||||
short getShards();
|
short getShards();
|
||||||
|
|
||||||
short getReplicas();
|
short getReplicas();
|
||||||
|
|
||||||
String getRefreshInterval();
|
String getRefreshInterval();
|
||||||
|
|
||||||
String getIndexStoreType();
|
String getIndexStoreType();
|
||||||
|
|
||||||
ElasticsearchPersistentProperty getVersionProperty();
|
ElasticsearchPersistentProperty getVersionProperty();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch.core.mapping;
|
|||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.data.mapping.PersistentProperty;
|
import org.springframework.data.mapping.PersistentProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElasticsearchPersistentProperty
|
* ElasticsearchPersistentProperty
|
||||||
*
|
*
|
||||||
|
@ -39,8 +39,8 @@ import static org.springframework.util.StringUtils.hasText;
|
|||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
*/
|
*/
|
||||||
public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntity<T, ElasticsearchPersistentProperty> implements
|
public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntity<T, ElasticsearchPersistentProperty>
|
||||||
ElasticsearchPersistentEntity<T>, ApplicationContextAware {
|
implements ElasticsearchPersistentEntity<T>, ApplicationContextAware {
|
||||||
|
|
||||||
private final StandardEvaluationContext context;
|
private final StandardEvaluationContext context;
|
||||||
private String indexName;
|
private String indexName;
|
||||||
@ -56,7 +56,8 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
|||||||
Class<T> clazz = typeInformation.getType();
|
Class<T> clazz = typeInformation.getType();
|
||||||
if (clazz.isAnnotationPresent(Document.class)) {
|
if (clazz.isAnnotationPresent(Document.class)) {
|
||||||
Document document = clazz.getAnnotation(Document.class);
|
Document document = clazz.getAnnotation(Document.class);
|
||||||
Assert.hasText(document.indexName(), " Unknown indexName. Make sure the indexName is defined. e.g @Document(indexName=\"foo\")");
|
Assert.hasText(document.indexName(),
|
||||||
|
" Unknown indexName. Make sure the indexName is defined. e.g @Document(indexName=\"foo\")");
|
||||||
this.indexName = typeInformation.getType().getAnnotation(Document.class).indexName();
|
this.indexName = typeInformation.getType().getAnnotation(Document.class).indexName();
|
||||||
this.indexType = hasText(document.type()) ? document.type() : clazz.getSimpleName().toLowerCase(Locale.ENGLISH);
|
this.indexType = hasText(document.type()) ? document.type() : clazz.getSimpleName().toLowerCase(Locale.ENGLISH);
|
||||||
this.shards = typeInformation.getType().getAnnotation(Document.class).shards();
|
this.shards = typeInformation.getType().getAnnotation(Document.class).shards();
|
||||||
|
@ -31,8 +31,8 @@ import java.util.Set;
|
|||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
*/
|
*/
|
||||||
public class SimpleElasticsearchPersistentProperty extends AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements
|
public class SimpleElasticsearchPersistentProperty extends
|
||||||
ElasticsearchPersistentProperty {
|
AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements ElasticsearchPersistentProperty {
|
||||||
|
|
||||||
private static final Set<Class<?>> SUPPORTED_ID_TYPES = new HashSet<Class<?>>();
|
private static final Set<Class<?>> SUPPORTED_ID_TYPES = new HashSet<Class<?>>();
|
||||||
private static final Set<String> SUPPORTED_ID_PROPERTY_NAMES = new HashSet<String>();
|
private static final Set<String> SUPPORTED_ID_PROPERTY_NAMES = new HashSet<String>();
|
||||||
|
@ -255,7 +255,6 @@ public class Criteria {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crates new CriteriaEntry allowing native elasticsearch expressions
|
* Crates new CriteriaEntry allowing native elasticsearch expressions
|
||||||
*
|
*
|
||||||
@ -346,7 +345,6 @@ public class Criteria {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void assertNoBlankInWildcardedQuery(String searchString, boolean leadingWildcard, boolean trailingWildcard) {
|
private void assertNoBlankInWildcardedQuery(String searchString, boolean leadingWildcard, boolean trailingWildcard) {
|
||||||
if (StringUtils.contains(searchString, CRITERIA_VALUE_SEPERATOR)) {
|
if (StringUtils.contains(searchString, CRITERIA_VALUE_SEPERATOR)) {
|
||||||
throw new InvalidDataAccessApiUsageException("Cannot constructQuery '" + (leadingWildcard ? "*" : "") + "\""
|
throw new InvalidDataAccessApiUsageException("Cannot constructQuery '" + (leadingWildcard ? "*" : "") + "\""
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@ -28,6 +27,7 @@ import org.springframework.util.Assert;
|
|||||||
public class CriteriaQuery extends AbstractQuery {
|
public class CriteriaQuery extends AbstractQuery {
|
||||||
|
|
||||||
private Criteria criteria;
|
private Criteria criteria;
|
||||||
|
|
||||||
private CriteriaQuery() {
|
private CriteriaQuery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeleteQuery
|
* DeleteQuery
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.index.query.FilterBuilder;
|
import org.elasticsearch.index.query.FilterBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.search.sort.SortBuilder;
|
import org.elasticsearch.search.sort.SortBuilder;
|
||||||
@ -43,7 +42,6 @@ public class NativeSearchQuery extends AbstractQuery implements SearchQuery {
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public FilterBuilder getFilter() {
|
public FilterBuilder getFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query
|
* Query
|
||||||
*
|
*
|
||||||
@ -32,7 +32,6 @@ public interface Query {
|
|||||||
public static final int DEFAULT_PAGE_SIZE = 10;
|
public static final int DEFAULT_PAGE_SIZE = 10;
|
||||||
public static final Pageable DEFAULT_PAGE = new PageRequest(0, DEFAULT_PAGE_SIZE);
|
public static final Pageable DEFAULT_PAGE = new PageRequest(0, DEFAULT_PAGE_SIZE);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* restrict result to entries on given page. Corresponds to the 'start' and 'rows' parameter in elasticsearch
|
* restrict result to entries on given page. Corresponds to the 'start' and 'rows' parameter in elasticsearch
|
||||||
*
|
*
|
||||||
@ -41,8 +40,6 @@ public interface Query {
|
|||||||
*/
|
*/
|
||||||
<T extends Query> T setPageable(Pageable pageable);
|
<T extends Query> T setPageable(Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get filter queries if defined
|
* Get filter queries if defined
|
||||||
*
|
*
|
||||||
@ -57,8 +54,6 @@ public interface Query {
|
|||||||
*/
|
*/
|
||||||
Pageable getPageable();
|
Pageable getPageable();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add {@link org.springframework.data.domain.Sort} to query
|
* Add {@link org.springframework.data.domain.Sort} to query
|
||||||
*
|
*
|
||||||
@ -72,41 +67,44 @@ public interface Query {
|
|||||||
*/
|
*/
|
||||||
Sort getSort();
|
Sort getSort();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Indices to be searched
|
* Get Indices to be searched
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> getIndices();
|
List<String> getIndices();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Indices to be added as part of search request
|
* Add Indices to be added as part of search request
|
||||||
|
*
|
||||||
* @param indices
|
* @param indices
|
||||||
*/
|
*/
|
||||||
void addIndices(String... indices);
|
void addIndices(String... indices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add types to be searched
|
* Add types to be searched
|
||||||
|
*
|
||||||
* @param types
|
* @param types
|
||||||
*/
|
*/
|
||||||
void addTypes(String... types);
|
void addTypes(String... types);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get types to be searched
|
* Get types to be searched
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> getTypes();
|
List<String> getTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add fields to be added as part of search request
|
* Add fields to be added as part of search request
|
||||||
|
*
|
||||||
* @param fields
|
* @param fields
|
||||||
*/
|
*/
|
||||||
void addFields(String... fields);
|
void addFields(String... fields);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get fields to be returned as part of search request
|
* Get fields to be returned as part of search request
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> getFields();
|
List<String> getFields();
|
||||||
|
@ -18,6 +18,7 @@ package org.springframework.data.elasticsearch.core.query;
|
|||||||
import org.elasticsearch.index.query.FilterBuilder;
|
import org.elasticsearch.index.query.FilterBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.search.sort.SortBuilder;
|
import org.elasticsearch.search.sort.SortBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NativeSearchQuery
|
* NativeSearchQuery
|
||||||
*
|
*
|
||||||
@ -27,6 +28,8 @@ import org.elasticsearch.search.sort.SortBuilder;
|
|||||||
*/
|
*/
|
||||||
public interface SearchQuery extends Query {
|
public interface SearchQuery extends Query {
|
||||||
QueryBuilder getQuery();
|
QueryBuilder getQuery();
|
||||||
|
|
||||||
FilterBuilder getFilter();
|
FilterBuilder getFilter();
|
||||||
|
|
||||||
SortBuilder getElasticsearchSort();
|
SortBuilder getElasticsearchSort();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ public class StringQuery extends AbstractQuery{
|
|||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSource() {
|
public String getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
|||||||
|
|
||||||
private final Bean<ElasticsearchOperations> elasticsearchOperationsBean;
|
private final Bean<ElasticsearchOperations> elasticsearchOperationsBean;
|
||||||
|
|
||||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers, Class<T> repositoryType,
|
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
||||||
BeanManager beanManager) {
|
Class<T> repositoryType, BeanManager beanManager) {
|
||||||
super(qualifiers, repositoryType, beanManager);
|
super(qualifiers, repositoryType, beanManager);
|
||||||
|
|
||||||
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
||||||
@ -46,7 +46,8 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
|
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
|
||||||
ElasticsearchOperations elasticsearchOperations = getDependencyInstance(elasticsearchOperationsBean, ElasticsearchOperations.class);
|
ElasticsearchOperations elasticsearchOperations = getDependencyInstance(elasticsearchOperationsBean,
|
||||||
|
ElasticsearchOperations.class);
|
||||||
return new ElasticsearchRepositoryFactory(elasticsearchOperations).getRepository(repositoryType);
|
return new ElasticsearchRepositoryFactory(elasticsearchOperations).getRepository(repositoryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T> Bean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers, BeanManager beanManager) {
|
private <T> Bean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers, BeanManager beanManager) {
|
||||||
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers.toString());
|
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers
|
||||||
|
.toString());
|
||||||
|
|
||||||
if (elasticsearchOperationsBean == null) {
|
if (elasticsearchOperationsBean == null) {
|
||||||
throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
|
throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
|
||||||
|
@ -21,8 +21,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration of the {@link EnableElasticsearchRepositories}
|
* {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration
|
||||||
* annotation.
|
* of the {@link EnableElasticsearchRepositories} annotation.
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -23,11 +23,10 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
|
|||||||
import org.springframework.data.repository.config.XmlRepositoryConfigurationSource;
|
import org.springframework.data.repository.config.XmlRepositoryConfigurationSource;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} implementation to configure Elasticsearch repository configuration support,
|
* {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} implementation to configure
|
||||||
* evaluating the {@link EnableElasticsearchRepositories} annotation or the equivalent XML element.
|
* Elasticsearch repository configuration support, evaluating the {@link EnableElasticsearchRepositories} annotation or
|
||||||
|
* the equivalent XML element.
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -24,8 +24,8 @@ import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
|||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for Spring Data
|
* Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for
|
||||||
* repositories by default.
|
* Spring Data repositories by default.
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -39,7 +39,8 @@ public @interface EnableElasticsearchRepositories {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.:
|
* Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.:
|
||||||
* {@code @EnableElasticsearchRepositories("org.my.pkg")} instead of {@code @EnableElasticsearchRepositories(basePackages="org.my.pkg")}.
|
* {@code @EnableElasticsearchRepositories("org.my.pkg")} instead of
|
||||||
|
* {@code @EnableElasticsearchRepositories(basePackages="org.my.pkg")}.
|
||||||
*/
|
*/
|
||||||
String[] value() default {};
|
String[] value() default {};
|
||||||
|
|
||||||
@ -85,7 +86,8 @@ public @interface EnableElasticsearchRepositories {
|
|||||||
String namedQueriesLocation() default "";
|
String namedQueriesLocation() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key of the {@link org.springframework.data.repository.query.QueryLookupStrategy} to be used for lookup queries for query methods. Defaults to
|
* Returns the key of the {@link org.springframework.data.repository.query.QueryLookupStrategy} to be used for lookup
|
||||||
|
* queries for query methods. Defaults to
|
||||||
* {@link org.springframework.data.repository.query.QueryLookupStrategy.Key#CREATE_IF_NOT_FOUND}.
|
* {@link org.springframework.data.repository.query.QueryLookupStrategy.Key#CREATE_IF_NOT_FOUND}.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -93,8 +95,8 @@ public @interface EnableElasticsearchRepositories {
|
|||||||
Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND;
|
Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link org.springframework.beans.factory.FactoryBean} class to be used for each repository instance. Defaults to
|
* Returns the {@link org.springframework.beans.factory.FactoryBean} class to be used for each repository instance.
|
||||||
* {@link ElasticsearchRepositoryFactoryBean}.
|
* Defaults to {@link ElasticsearchRepositoryFactoryBean}.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -103,8 +105,8 @@ public @interface EnableElasticsearchRepositories {
|
|||||||
// Elasticsearch specific configuration
|
// Elasticsearch specific configuration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the name of the {@link ElasticsearchTemplate} bean definition to be used to create repositories discovered
|
* Configures the name of the {@link ElasticsearchTemplate} bean definition to be used to create repositories
|
||||||
* through this annotation. Defaults to {@code elasticsearchTemplate}.
|
* discovered through this annotation. Defaults to {@code elasticsearchTemplate}.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,8 @@ public abstract class AbstractElasticsearchRepositoryQuery implements Repository
|
|||||||
protected ElasticsearchQueryMethod queryMethod;
|
protected ElasticsearchQueryMethod queryMethod;
|
||||||
protected ElasticsearchOperations elasticsearchOperations;
|
protected ElasticsearchOperations elasticsearchOperations;
|
||||||
|
|
||||||
public AbstractElasticsearchRepositoryQuery(ElasticsearchQueryMethod queryMethod, ElasticsearchOperations elasticsearchOperations) {
|
public AbstractElasticsearchRepositoryQuery(ElasticsearchQueryMethod queryMethod,
|
||||||
|
ElasticsearchOperations elasticsearchOperations) {
|
||||||
this.queryMethod = queryMethod;
|
this.queryMethod = queryMethod;
|
||||||
this.elasticsearchOperations = elasticsearchOperations;
|
this.elasticsearchOperations = elasticsearchOperations;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repository.query;
|
package org.springframework.data.elasticsearch.repository.query;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
||||||
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
|
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
|
||||||
@ -35,7 +34,6 @@ public class ElasticsearchPartQuery extends AbstractElasticsearchRepositoryQuery
|
|||||||
private final PartTree tree;
|
private final PartTree tree;
|
||||||
private final MappingContext<?, ElasticsearchPersistentProperty> mappingContext;
|
private final MappingContext<?, ElasticsearchPersistentProperty> mappingContext;
|
||||||
|
|
||||||
|
|
||||||
public ElasticsearchPartQuery(ElasticsearchQueryMethod method, ElasticsearchOperations elasticsearchOperations) {
|
public ElasticsearchPartQuery(ElasticsearchQueryMethod method, ElasticsearchOperations elasticsearchOperations) {
|
||||||
super(method, elasticsearchOperations);
|
super(method, elasticsearchOperations);
|
||||||
this.tree = new PartTree(method.getName(), method.getEntityInformation().getJavaType());
|
this.tree = new PartTree(method.getName(), method.getEntityInformation().getJavaType());
|
||||||
|
@ -36,9 +36,11 @@ public class ElasticsearchQueryMethod extends QueryMethod {
|
|||||||
private final ElasticsearchEntityInformation<?, ?> entityInformation;
|
private final ElasticsearchEntityInformation<?, ?> entityInformation;
|
||||||
private Method method;
|
private Method method;
|
||||||
|
|
||||||
public ElasticsearchQueryMethod(Method method, RepositoryMetadata metadata, ElasticsearchEntityInformationCreator elasticsearchEntityInformationCreator) {
|
public ElasticsearchQueryMethod(Method method, RepositoryMetadata metadata,
|
||||||
|
ElasticsearchEntityInformationCreator elasticsearchEntityInformationCreator) {
|
||||||
super(method, metadata);
|
super(method, metadata);
|
||||||
this.entityInformation = elasticsearchEntityInformationCreator.getEntityInformation(metadata.getReturnedDomainClass(method));
|
this.entityInformation = elasticsearchEntityInformationCreator.getEntityInformation(metadata
|
||||||
|
.getReturnedDomainClass(method));
|
||||||
this.method = method;
|
this.method = method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repository.query;
|
package org.springframework.data.elasticsearch.repository.query;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.core.convert.support.GenericConversionService;
|
import org.springframework.core.convert.support.GenericConversionService;
|
||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.core.convert.DateTimeConverters;
|
import org.springframework.data.elasticsearch.core.convert.DateTimeConverters;
|
||||||
@ -52,7 +51,8 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchStringQuery(ElasticsearchQueryMethod queryMethod, ElasticsearchOperations elasticsearchOperations, String query) {
|
public ElasticsearchStringQuery(ElasticsearchQueryMethod queryMethod,
|
||||||
|
ElasticsearchOperations elasticsearchOperations, String query) {
|
||||||
super(queryMethod, elasticsearchOperations);
|
super(queryMethod, elasticsearchOperations);
|
||||||
Assert.notNull(query, "Query cannot be empty");
|
Assert.notNull(query, "Query cannot be empty");
|
||||||
this.query = query;
|
this.query = query;
|
||||||
@ -75,7 +75,6 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
|
|||||||
return elasticsearchOperations.queryForObject(stringQuery, queryMethod.getEntityInformation().getJavaType());
|
return elasticsearchOperations.queryForObject(stringQuery, queryMethod.getEntityInformation().getJavaType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected StringQuery createQuery(ParametersParameterAccessor parameterAccessor) {
|
protected StringQuery createQuery(ParametersParameterAccessor parameterAccessor) {
|
||||||
String queryString = replacePlaceholders(this.query, parameterAccessor);
|
String queryString = replacePlaceholders(this.query, parameterAccessor);
|
||||||
return new StringQuery(queryString);
|
return new StringQuery(queryString);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repository.query.parser;
|
package org.springframework.data.elasticsearch.repository.query.parser;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
||||||
@ -41,7 +40,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
|||||||
|
|
||||||
private final MappingContext<?, ElasticsearchPersistentProperty> context;
|
private final MappingContext<?, ElasticsearchPersistentProperty> context;
|
||||||
|
|
||||||
public ElasticsearchQueryCreator(PartTree tree, ParameterAccessor parameters, MappingContext<?, ElasticsearchPersistentProperty> context) {
|
public ElasticsearchQueryCreator(PartTree tree, ParameterAccessor parameters,
|
||||||
|
MappingContext<?, ElasticsearchPersistentProperty> context) {
|
||||||
super(tree, parameters);
|
super(tree, parameters);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CriteriaQuery create(Part part, Iterator<Object> iterator) {
|
protected CriteriaQuery create(Part part, Iterator<Object> iterator) {
|
||||||
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
|
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context
|
||||||
|
.getPersistentPropertyPath(part.getProperty());
|
||||||
return new CriteriaQuery(from(part.getType(),
|
return new CriteriaQuery(from(part.getType(),
|
||||||
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
||||||
}
|
}
|
||||||
@ -63,7 +64,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
|||||||
if (base == null) {
|
if (base == null) {
|
||||||
return create(part, iterator);
|
return create(part, iterator);
|
||||||
}
|
}
|
||||||
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
|
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context
|
||||||
|
.getPersistentPropertyPath(part.getProperty());
|
||||||
return base.addCriteria(from(part.getType(),
|
return base.addCriteria(from(part.getType(),
|
||||||
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
||||||
}
|
}
|
||||||
@ -81,7 +83,6 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
|||||||
return query.addSort(sort);
|
return query.addSort(sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Criteria from(Part.Type type, Criteria instance, Iterator<?> parameters) {
|
private Criteria from(Part.Type type, Criteria instance, Iterator<?> parameters) {
|
||||||
Criteria criteria = instance;
|
Criteria criteria = instance;
|
||||||
if (criteria == null) {
|
if (criteria == null) {
|
||||||
|
@ -36,15 +36,16 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
|||||||
import static org.springframework.data.elasticsearch.core.query.Query.DEFAULT_PAGE;
|
import static org.springframework.data.elasticsearch.core.query.Query.DEFAULT_PAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elasticsearch specific repository implementation. Likely to be used as target within {@link ElasticsearchRepositoryFactory}
|
* Elasticsearch specific repository implementation. Likely to be used as target within
|
||||||
|
* {@link ElasticsearchRepositoryFactory}
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
* @author Ryan Henszey
|
* @author Ryan Henszey
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractElasticsearchRepository<T,ID extends Serializable> implements ElasticsearchRepository<T, ID> {
|
public abstract class AbstractElasticsearchRepository<T, ID extends Serializable> implements
|
||||||
|
ElasticsearchRepository<T, ID> {
|
||||||
|
|
||||||
protected ElasticsearchOperations elasticsearchOperations;
|
protected ElasticsearchOperations elasticsearchOperations;
|
||||||
protected Class<T> entityClass;
|
protected Class<T> entityClass;
|
||||||
@ -58,7 +59,8 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
this.setElasticsearchOperations(elasticsearchOperations);
|
this.setElasticsearchOperations(elasticsearchOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata, ElasticsearchOperations elasticsearchOperations) {
|
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata,
|
||||||
|
ElasticsearchOperations elasticsearchOperations) {
|
||||||
this(elasticsearchOperations);
|
this(elasticsearchOperations);
|
||||||
Assert.notNull(metadata);
|
Assert.notNull(metadata);
|
||||||
this.entityInformation = metadata;
|
this.entityInformation = metadata;
|
||||||
@ -93,10 +95,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<T> findAll(Pageable pageable) {
|
public Page<T> findAll(Pageable pageable) {
|
||||||
SearchQuery query = new NativeSearchQueryBuilder()
|
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withPageable(pageable).build();
|
||||||
.withQuery(matchAllQuery())
|
|
||||||
.withPageable(pageable)
|
|
||||||
.build();
|
|
||||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,25 +105,21 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
if (itemCount == 0) {
|
if (itemCount == 0) {
|
||||||
return new PageImpl<T>(Collections.<T> emptyList());
|
return new PageImpl<T>(Collections.<T> emptyList());
|
||||||
}
|
}
|
||||||
SearchQuery query = new NativeSearchQueryBuilder()
|
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||||
.withQuery(matchAllQuery())
|
.withPageable(new PageRequest(0, itemCount, sort)).build();
|
||||||
.withPageable(new PageRequest(0,itemCount, sort))
|
|
||||||
.build();
|
|
||||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<T> findAll(Iterable<ID> ids) {
|
public Iterable<T> findAll(Iterable<ID> ids) {
|
||||||
SearchQuery query = new NativeSearchQueryBuilder()
|
SearchQuery query = new NativeSearchQueryBuilder().withQuery(inQuery(entityInformation.getIdAttribute(), ids))
|
||||||
.withQuery(inQuery(entityInformation.getIdAttribute(), ids))
|
|
||||||
.build();
|
.build();
|
||||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() {
|
public long count() {
|
||||||
SearchQuery query = new NativeSearchQueryBuilder()
|
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||||
.withQuery(matchAllQuery()).build();
|
|
||||||
return elasticsearchOperations.count(query, getEntityClass());
|
return elasticsearchOperations.count(query, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +170,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<T> search(QueryBuilder query) {
|
public Iterable<T> search(QueryBuilder query) {
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(query).build();
|
||||||
.withQuery(query).build();
|
|
||||||
int count = (int) elasticsearchOperations.count(searchQuery, getEntityClass());
|
int count = (int) elasticsearchOperations.count(searchQuery, getEntityClass());
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return new PageImpl<T>(Collections.<T> emptyList());
|
return new PageImpl<T>(Collections.<T> emptyList());
|
||||||
@ -187,10 +181,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<T> search(QueryBuilder query, Pageable pageable) {
|
public Page<T> search(QueryBuilder query, Pageable pageable) {
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(query).withPageable(pageable).build();
|
||||||
.withQuery(query)
|
|
||||||
.withPageable(pageable)
|
|
||||||
.build();
|
|
||||||
return elasticsearchOperations.queryForPage(searchQuery, getEntityClass());
|
return elasticsearchOperations.queryForPage(searchQuery, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,11 +207,11 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
return elasticsearchOperations.moreLikeThis(query, getEntityClass());
|
return elasticsearchOperations.moreLikeThis(query, getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(ID id) {
|
public void delete(ID id) {
|
||||||
Assert.notNull(id, "Cannot delete entity with id 'null'.");
|
Assert.notNull(id, "Cannot delete entity with id 'null'.");
|
||||||
elasticsearchOperations.delete(entityInformation.getIndexName(), entityInformation.getType(),stringIdRepresentation(id));
|
elasticsearchOperations.delete(entityInformation.getIndexName(), entityInformation.getType(),
|
||||||
|
stringIdRepresentation(id));
|
||||||
elasticsearchOperations.refresh(entityInformation.getIndexName(), true);
|
elasticsearchOperations.refresh(entityInformation.getIndexName(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +289,6 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
|||||||
this.elasticsearchOperations = elasticsearchOperations;
|
this.elasticsearchOperations = elasticsearchOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected ID extractIdFromBean(T entity) {
|
protected ID extractIdFromBean(T entity) {
|
||||||
if (entityInformation != null) {
|
if (entityInformation != null) {
|
||||||
return entityInformation.getId(entity);
|
return entityInformation.getId(entity);
|
||||||
|
@ -29,7 +29,10 @@ import java.io.Serializable;
|
|||||||
public interface ElasticsearchEntityInformation<T, ID extends Serializable> extends EntityInformation<T, ID> {
|
public interface ElasticsearchEntityInformation<T, ID extends Serializable> extends EntityInformation<T, ID> {
|
||||||
|
|
||||||
String getIdAttribute();
|
String getIdAttribute();
|
||||||
|
|
||||||
String getIndexName();
|
String getIndexName();
|
||||||
|
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
Long getVersion(T entity);
|
Long getVersion(T entity);
|
||||||
}
|
}
|
||||||
|
@ -42,15 +42,14 @@ import org.springframework.util.Assert;
|
|||||||
*/
|
*/
|
||||||
public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
||||||
|
|
||||||
|
|
||||||
private final ElasticsearchOperations elasticsearchOperations;
|
private final ElasticsearchOperations elasticsearchOperations;
|
||||||
private final ElasticsearchEntityInformationCreator entityInformationCreator;
|
private final ElasticsearchEntityInformationCreator entityInformationCreator;
|
||||||
|
|
||||||
public ElasticsearchRepositoryFactory(ElasticsearchOperations elasticsearchOperations) {
|
public ElasticsearchRepositoryFactory(ElasticsearchOperations elasticsearchOperations) {
|
||||||
Assert.notNull(elasticsearchOperations);
|
Assert.notNull(elasticsearchOperations);
|
||||||
this.elasticsearchOperations = elasticsearchOperations;
|
this.elasticsearchOperations = elasticsearchOperations;
|
||||||
this.entityInformationCreator = new ElasticsearchEntityInformationCreatorImpl(elasticsearchOperations.getElasticsearchConverter()
|
this.entityInformationCreator = new ElasticsearchEntityInformationCreatorImpl(elasticsearchOperations
|
||||||
.getMappingContext());
|
.getElasticsearchConverter().getMappingContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,17 +66,16 @@ public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
|||||||
AbstractElasticsearchRepository repository;
|
AbstractElasticsearchRepository repository;
|
||||||
|
|
||||||
// Probably a better way to store and look these up.
|
// Probably a better way to store and look these up.
|
||||||
if(Integer.class.isAssignableFrom(entityInformation.getIdType()) ||
|
if (Integer.class.isAssignableFrom(entityInformation.getIdType())
|
||||||
Long.class.isAssignableFrom(entityInformation.getIdType()) ||
|
|| Long.class.isAssignableFrom(entityInformation.getIdType())
|
||||||
Double.class.isAssignableFrom(entityInformation.getIdType())){
|
|| Double.class.isAssignableFrom(entityInformation.getIdType())) {
|
||||||
// logger.debug("Using NumberKeyedRepository for " + metadata.getRepositoryInterface());
|
// logger.debug("Using NumberKeyedRepository for " + metadata.getRepositoryInterface());
|
||||||
repository = new NumberKeyedRepository(getEntityInformation(metadata.getDomainType()), elasticsearchOperations);
|
repository = new NumberKeyedRepository(getEntityInformation(metadata.getDomainType()), elasticsearchOperations);
|
||||||
}
|
} else if (entityInformation.getIdType() == String.class) {
|
||||||
else if (entityInformation.getIdType() == String.class){
|
|
||||||
// logger.debug("Using SimpleElasticsearchRepository for " + metadata.getRepositoryInterface());
|
// logger.debug("Using SimpleElasticsearchRepository for " + metadata.getRepositoryInterface());
|
||||||
repository = new SimpleElasticsearchRepository(getEntityInformation(metadata.getDomainType()), elasticsearchOperations);
|
repository = new SimpleElasticsearchRepository(getEntityInformation(metadata.getDomainType()),
|
||||||
}
|
elasticsearchOperations);
|
||||||
else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unsuppored ID type " + entityInformation.getIdType());
|
throw new IllegalArgumentException("Unsuppored ID type " + entityInformation.getIdType());
|
||||||
}
|
}
|
||||||
repository.setEntityClass(metadata.getDomainType());
|
repository.setEntityClass(metadata.getDomainType());
|
||||||
@ -113,8 +111,7 @@ public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
|||||||
if (namedQueries.hasQuery(namedQueryName)) {
|
if (namedQueries.hasQuery(namedQueryName)) {
|
||||||
String namedQuery = namedQueries.getQuery(namedQueryName);
|
String namedQuery = namedQueries.getQuery(namedQueryName);
|
||||||
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, namedQuery);
|
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, namedQuery);
|
||||||
}
|
} else if (queryMethod.hasAnnotatedQuery()) {
|
||||||
else if (queryMethod.hasAnnotatedQuery()) {
|
|
||||||
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, queryMethod.getAnnotatedQuery());
|
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, queryMethod.getAnnotatedQuery());
|
||||||
}
|
}
|
||||||
return new ElasticsearchPartQuery(queryMethod, elasticsearchOperations);
|
return new ElasticsearchPartQuery(queryMethod, elasticsearchOperations);
|
||||||
|
@ -24,7 +24,8 @@ import org.springframework.util.Assert;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spring {@link org.springframework.beans.factory.FactoryBean} implementation to ease container based configuration for XML namespace and JavaConfig.
|
* Spring {@link org.springframework.beans.factory.FactoryBean} implementation to ease container based configuration for
|
||||||
|
* XML namespace and JavaConfig.
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -54,7 +55,6 @@ public class ElasticsearchRepositoryFactoryBean<T extends Repository<S, ID>, S,
|
|||||||
Assert.notNull(operations, "ElasticsearchOperations must be configured!");
|
Assert.notNull(operations, "ElasticsearchOperations must be configured!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RepositoryFactorySupport createRepositoryFactory() {
|
protected RepositoryFactorySupport createRepositoryFactory() {
|
||||||
return new ElasticsearchRepositoryFactory(operations);
|
return new ElasticsearchRepositoryFactory(operations);
|
||||||
|
@ -26,7 +26,8 @@ import org.springframework.data.repository.core.support.AbstractEntityInformatio
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elasticsearch specific implementation of {@link org.springframework.data.repository.core.support.AbstractEntityInformation}
|
* Elasticsearch specific implementation of
|
||||||
|
* {@link org.springframework.data.repository.core.support.AbstractEntityInformation}
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @param <ID>
|
* @param <ID>
|
||||||
@ -75,7 +76,9 @@ public class MappingElasticsearchEntityInformation<T, ID extends Serializable> e
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getIdAttribute() {
|
public String getIdAttribute() {
|
||||||
Assert.notNull(entityMetadata.getIdProperty(),"Unable to identify 'id' property in class " + entityMetadata.getType().getSimpleName() +". Make sure the 'id' property is annotated with @Id or named as 'id' or 'documentId' ");
|
Assert.notNull(entityMetadata.getIdProperty(), "Unable to identify 'id' property in class "
|
||||||
|
+ entityMetadata.getType().getSimpleName()
|
||||||
|
+ ". Make sure the 'id' property is annotated with @Id or named as 'id' or 'documentId' ");
|
||||||
return entityMetadata.getIdProperty().getFieldName();
|
return entityMetadata.getIdProperty().getFieldName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,5 +105,3 @@ public class MappingElasticsearchEntityInformation<T, ID extends Serializable> e
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ package org.springframework.data.elasticsearch.repository.support;
|
|||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elasticsearch specific repository implementation. Likely to be used as target within {@link ElasticsearchRepositoryFactory}
|
* Elasticsearch specific repository implementation. Likely to be used as target within
|
||||||
|
* {@link ElasticsearchRepositoryFactory}
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
@ -27,12 +28,12 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
|||||||
*/
|
*/
|
||||||
public class NumberKeyedRepository<T, ID extends Number> extends AbstractElasticsearchRepository<T, ID> {
|
public class NumberKeyedRepository<T, ID extends Number> extends AbstractElasticsearchRepository<T, ID> {
|
||||||
|
|
||||||
|
|
||||||
public NumberKeyedRepository() {
|
public NumberKeyedRepository() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NumberKeyedRepository(ElasticsearchEntityInformation<T, ID> metadata,ElasticsearchOperations elasticsearchOperations) {
|
public NumberKeyedRepository(ElasticsearchEntityInformation<T, ID> metadata,
|
||||||
|
ElasticsearchOperations elasticsearchOperations) {
|
||||||
super(metadata, elasticsearchOperations);
|
super(metadata, elasticsearchOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,12 +41,9 @@ public class NumberKeyedRepository<T,ID extends Number> extends AbstractElastics
|
|||||||
super(elasticsearchOperations);
|
super(elasticsearchOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String stringIdRepresentation(ID id) {
|
protected String stringIdRepresentation(ID id) {
|
||||||
return String.valueOf(id);
|
return String.valueOf(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ package org.springframework.data.elasticsearch.repository.support;
|
|||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elasticsearch specific repository implementation. Likely to be used as target within {@link ElasticsearchRepositoryFactory}
|
* Elasticsearch specific repository implementation. Likely to be used as target within
|
||||||
|
* {@link ElasticsearchRepositoryFactory}
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
@ -31,7 +32,8 @@ public class SimpleElasticsearchRepository<T> extends AbstractElasticsearchRepos
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T, String> metadata,ElasticsearchOperations elasticsearchOperations) {
|
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T, String> metadata,
|
||||||
|
ElasticsearchOperations elasticsearchOperations) {
|
||||||
super(metadata, elasticsearchOperations);
|
super(metadata, elasticsearchOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch;
|
|||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -66,6 +66,4 @@ public class DoubleIDEntity {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import org.springframework.data.elasticsearch.annotations.Document;
|
|||||||
@Document(indexName = "integer-keyed-entity", type = "integer-keyed-entity", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
|
@Document(indexName = "integer-keyed-entity", type = "integer-keyed-entity", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
|
||||||
public class IntegerIDEntity {
|
public class IntegerIDEntity {
|
||||||
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String type;
|
private String type;
|
||||||
@ -67,6 +66,4 @@ public class IntegerIDEntity {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.data.elasticsearch.repositories.SampleElasticSearchBookRepository;
|
import org.springframework.data.elasticsearch.repositories.SampleElasticSearchBookRepository;
|
||||||
@ -24,11 +23,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
|
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -40,7 +39,6 @@ public class NestedObjectTests{
|
|||||||
@Resource
|
@Resource
|
||||||
private SampleElasticSearchBookRepository repository;
|
private SampleElasticSearchBookRepository repository;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldIndexNestedObject() {
|
public void shouldIndexNestedObject() {
|
||||||
// given
|
// given
|
||||||
@ -58,4 +56,3 @@ public class NestedObjectTests{
|
|||||||
assertThat(repository.findOne(id), is(notNullValue()));
|
assertThat(repository.findOne(id), is(notNullValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -15,23 +15,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.BeanCreationException;
|
import org.springframework.beans.factory.BeanCreationException;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
import org.springframework.data.elasticsearch.repositories.NonDocumentEntityRepository;
|
import org.springframework.data.elasticsearch.repositories.NonDocumentEntityRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
*/
|
*/
|
||||||
public class NonDocumentEntityTests {
|
public class NonDocumentEntityTests {
|
||||||
|
|
||||||
|
|
||||||
@Test(expected = BeanCreationException.class)
|
@Test(expected = BeanCreationException.class)
|
||||||
public void shouldNotInitialiseRepositoryWithNonDocument() {
|
public void shouldNotInitialiseRepositoryWithNonDocument() {
|
||||||
// when
|
// when
|
||||||
ClassPathXmlApplicationContext ctx =
|
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/repository-non-document-entity.xml");
|
||||||
new ClassPathXmlApplicationContext("/repository-non-document-entity.xml");
|
|
||||||
ctx.getBean(NonDocumentEntityRepository.class);
|
ctx.getBean(NonDocumentEntityRepository.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,24 +94,13 @@ public class SampleEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
SampleEntity rhs = (SampleEntity) obj;
|
SampleEntity rhs = (SampleEntity) obj;
|
||||||
return new EqualsBuilder().append(this.id, rhs.id)
|
return new EqualsBuilder().append(this.id, rhs.id).append(this.type, rhs.type).append(this.message, rhs.message)
|
||||||
.append(this.type, rhs.type)
|
.append(this.rate, rhs.rate).append(this.available, rhs.available).append(this.version, rhs.version).isEquals();
|
||||||
.append(this.message, rhs.message)
|
|
||||||
.append(this.rate,rhs.rate)
|
|
||||||
.append(this.available,rhs.available)
|
|
||||||
.append(this.version,rhs.version)
|
|
||||||
.isEquals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return new HashCodeBuilder()
|
return new HashCodeBuilder().append(id).append(type).append(message).append(rate).append(available).append(version)
|
||||||
.append(id)
|
|
||||||
.append(type)
|
|
||||||
.append(message)
|
|
||||||
.append(rate)
|
|
||||||
.append(available)
|
|
||||||
.append(version)
|
|
||||||
.toHashCode();
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
import org.springframework.data.elasticsearch.annotations.Field;
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
@ -50,7 +49,6 @@ public class SampleMappingEntity {
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class NestedEntity {
|
static class NestedEntity {
|
||||||
@Field(type = "string")
|
@Field(type = "string")
|
||||||
private String someField;
|
private String someField;
|
||||||
@ -65,6 +63,3 @@ public class SampleMappingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ public class ElasticsearchNamespaceHandlerTests {
|
|||||||
@Test
|
@Test
|
||||||
public void shouldCreateRepository() {
|
public void shouldCreateRepository() {
|
||||||
assertThat(context.getBean(TransportClientFactoryBean.class), is(notNullValue()));
|
assertThat(context.getBean(TransportClientFactoryBean.class), is(notNullValue()));
|
||||||
assertThat(context.getBean(SampleElasticsearchRepository.class), is(instanceOf(SampleElasticsearchRepository.class)));
|
assertThat(context.getBean(SampleElasticsearchRepository.class),
|
||||||
|
is(instanceOf(SampleElasticsearchRepository.class)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.config;
|
package org.springframework.data.elasticsearch.config;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core;
|
package org.springframework.data.elasticsearch.core;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.sort.FieldSortBuilder;
|
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||||
@ -45,6 +44,7 @@ import static org.elasticsearch.index.query.QueryBuilders.fieldQuery;
|
|||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -254,10 +254,8 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.index(indexQuery);
|
elasticsearchTemplate.index(indexQuery);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
|
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||||
.withQuery(matchAllQuery())
|
.withFilter(boolFilter().must(termFilter("id", documentId))).build();
|
||||||
.withFilter(boolFilter().must(termFilter("id", documentId)))
|
|
||||||
.build();
|
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
@ -311,10 +309,8 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
|
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||||
.withQuery(matchAllQuery())
|
.withSort(new FieldSortBuilder("rate").ignoreUnmapped(true).order(SortOrder.ASC)).build();
|
||||||
.withSort(new FieldSortBuilder("rate").ignoreUnmapped(true).order(SortOrder.ASC))
|
|
||||||
.build();
|
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
@ -387,7 +383,8 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.index(indexQuery);
|
elasticsearchTemplate.index(indexQuery);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
|
|
||||||
StringQuery stringQuery = new StringQuery(matchAllQuery().toString(),new PageRequest(0,10), new Sort(new Sort.Order(Sort.Direction.ASC,"messsage")));
|
StringQuery stringQuery = new StringQuery(matchAllQuery().toString(), new PageRequest(0, 10), new Sort(
|
||||||
|
new Sort.Order(Sort.Direction.ASC, "messsage")));
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(stringQuery, SampleEntity.class);
|
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(stringQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
@ -426,7 +423,6 @@ public class ElasticsearchTemplateTests {
|
|||||||
assertThat(created, is(true));
|
assertThat(created, is(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldExecuteGivenCriteriaQuery() {
|
public void shouldExecuteGivenCriteriaQuery() {
|
||||||
// given
|
// given
|
||||||
@ -466,12 +462,8 @@ public class ElasticsearchTemplateTests {
|
|||||||
|
|
||||||
elasticsearchTemplate.index(indexQuery);
|
elasticsearchTemplate.index(indexQuery);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withIndices("test-index")
|
||||||
.withQuery(matchAllQuery())
|
.withTypes("test-type").withFields("message").build();
|
||||||
.withIndices("test-index")
|
|
||||||
.withTypes("test-type")
|
|
||||||
.withFields("message")
|
|
||||||
.build();
|
|
||||||
// when
|
// when
|
||||||
Page<String> page = elasticsearchTemplate.queryForPage(searchQuery, new ResultsMapper<String>() {
|
Page<String> page = elasticsearchTemplate.queryForPage(searchQuery, new ResultsMapper<String>() {
|
||||||
@Override
|
@Override
|
||||||
@ -492,11 +484,11 @@ public class ElasticsearchTemplateTests {
|
|||||||
@Test
|
@Test
|
||||||
public void shouldReturnSimilarResultsGivenMoreLikeThisQuery() {
|
public void shouldReturnSimilarResultsGivenMoreLikeThisQuery() {
|
||||||
// given
|
// given
|
||||||
String sampleMessage = "So we build a web site or an application and want to add search to it, " +
|
String sampleMessage = "So we build a web site or an application and want to add search to it, "
|
||||||
"and then it hits us: getting search working is hard. We want our search solution to be fast," +
|
+ "and then it hits us: getting search working is hard. We want our search solution to be fast,"
|
||||||
" we want a painless setup and a completely free search schema, we want to be able to index data simply using JSON over HTTP, " +
|
+ " we want a painless setup and a completely free search schema, we want to be able to index data simply using JSON over HTTP, "
|
||||||
"we want our search server to be always available, we want to be able to start with one machine and scale to hundreds, " +
|
+ "we want our search server to be always available, we want to be able to start with one machine and scale to hundreds, "
|
||||||
"we want real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
+ "we want real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
||||||
|
|
||||||
String documentId1 = randomNumeric(5);
|
String documentId1 = randomNumeric(5);
|
||||||
SampleEntity sampleEntity1 = new SampleEntity();
|
SampleEntity sampleEntity1 = new SampleEntity();
|
||||||
@ -523,7 +515,6 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.index(indexQuery2);
|
elasticsearchTemplate.index(indexQuery2);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
|
|
||||||
|
|
||||||
MoreLikeThisQuery moreLikeThisQuery = new MoreLikeThisQuery();
|
MoreLikeThisQuery moreLikeThisQuery = new MoreLikeThisQuery();
|
||||||
moreLikeThisQuery.setId(documentId2);
|
moreLikeThisQuery.setId(documentId2);
|
||||||
moreLikeThisQuery.addFields("message");
|
moreLikeThisQuery.addFields("message");
|
||||||
@ -569,12 +560,8 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
// then
|
// then
|
||||||
|
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withIndices("test-index")
|
||||||
.withQuery(matchAllQuery())
|
.withTypes("test-type").withPageable(new PageRequest(0, 1)).build();
|
||||||
.withIndices("test-index")
|
|
||||||
.withTypes("test-type")
|
|
||||||
.withPageable(new PageRequest(0,1))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false);
|
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false);
|
||||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||||
@ -600,8 +587,7 @@ public class ElasticsearchTemplateTests {
|
|||||||
if (page != null) {
|
if (page != null) {
|
||||||
sampleEntities.addAll(page.getContent());
|
sampleEntities.addAll(page.getContent());
|
||||||
hasRecords = page.hasNextPage();
|
hasRecords = page.hasNextPage();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
hasRecords = false;
|
hasRecords = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,9 +641,12 @@ public class ElasticsearchTemplateTests {
|
|||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
// when
|
// when
|
||||||
CriteriaQuery singleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("test"));
|
CriteriaQuery singleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("test"));
|
||||||
CriteriaQuery multipleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").and("message").contains("message"));
|
CriteriaQuery multipleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").and("message")
|
||||||
List<SampleEntity> sampleEntitiesForSingleCriteria = elasticsearchTemplate.queryForList(singleCriteriaQuery,SampleEntity.class);
|
.contains("message"));
|
||||||
List<SampleEntity> sampleEntitiesForAndCriteria = elasticsearchTemplate.queryForList(multipleCriteriaQuery,SampleEntity.class);
|
List<SampleEntity> sampleEntitiesForSingleCriteria = elasticsearchTemplate.queryForList(singleCriteriaQuery,
|
||||||
|
SampleEntity.class);
|
||||||
|
List<SampleEntity> sampleEntitiesForAndCriteria = elasticsearchTemplate.queryForList(multipleCriteriaQuery,
|
||||||
|
SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
assertThat(sampleEntitiesForSingleCriteria.size(), is(2));
|
assertThat(sampleEntitiesForSingleCriteria.size(), is(2));
|
||||||
assertThat(sampleEntitiesForAndCriteria.size(), is(1));
|
assertThat(sampleEntitiesForAndCriteria.size(), is(1));
|
||||||
@ -733,6 +722,4 @@ public class ElasticsearchTemplateTests {
|
|||||||
assertThat(elasticsearchTemplate.indexExists(clazz), is(false));
|
assertThat(elasticsearchTemplate.indexExists(clazz), is(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ public class DateTimeConvertersTests {
|
|||||||
@Test
|
@Test
|
||||||
public void testJodaDateTimeConverter() {
|
public void testJodaDateTimeConverter() {
|
||||||
DateTime dateTime = new DateTime(2013, 1, 24, 6, 35, 0, DateTimeZone.UTC);
|
DateTime dateTime = new DateTime(2013, 1, 24, 6, 35, 0, DateTimeZone.UTC);
|
||||||
Assert.assertEquals("2013-01-24T06:35:00.000Z",
|
Assert
|
||||||
DateTimeConverters.JodaDateTimeConverter.INSTANCE.convert(dateTime));
|
.assertEquals("2013-01-24T06:35:00.000Z", DateTimeConverters.JodaDateTimeConverter.INSTANCE.convert(dateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.convert;
|
package org.springframework.data.elasticsearch.core.convert;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.core.convert.ConversionService;
|
import org.springframework.core.convert.ConversionService;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
||||||
@ -23,6 +22,7 @@ import org.springframework.data.mapping.context.MappingContext;
|
|||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.data.util.TypeInformation;
|
|||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -34,40 +35,39 @@ public class SimpleElasticsearchPersistentEntityTests {
|
|||||||
public void shouldThrowExceptionGivenVersionPropertyIsNotLong() throws NoSuchFieldException, IntrospectionException {
|
public void shouldThrowExceptionGivenVersionPropertyIsNotLong() throws NoSuchFieldException, IntrospectionException {
|
||||||
// given
|
// given
|
||||||
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithWrongVersionType.class);
|
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithWrongVersionType.class);
|
||||||
SimpleElasticsearchPersistentProperty persistentProperty =
|
SimpleElasticsearchPersistentProperty persistentProperty = new SimpleElasticsearchPersistentProperty(
|
||||||
new SimpleElasticsearchPersistentProperty(EntityWithWrongVersionType.class.getDeclaredField("version"),
|
EntityWithWrongVersionType.class.getDeclaredField("version"), new PropertyDescriptor("version",
|
||||||
new PropertyDescriptor("version", EntityWithWrongVersionType.class),
|
EntityWithWrongVersionType.class), new SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType>(
|
||||||
new SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType>(typeInformation),
|
typeInformation), new SimpleTypeHolder());
|
||||||
new SimpleTypeHolder());
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
new SimpleElasticsearchPersistentEntity(typeInformation).addPersistentProperty(persistentProperty);
|
new SimpleElasticsearchPersistentEntity(typeInformation).addPersistentProperty(persistentProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(expected = MappingException.class)
|
@Test(expected = MappingException.class)
|
||||||
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() throws NoSuchFieldException, IntrospectionException {
|
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() throws NoSuchFieldException,
|
||||||
|
IntrospectionException {
|
||||||
// given
|
// given
|
||||||
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithMultipleVersionField.class);
|
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithMultipleVersionField.class);
|
||||||
SimpleElasticsearchPersistentProperty persistentProperty1 =
|
SimpleElasticsearchPersistentProperty persistentProperty1 = new SimpleElasticsearchPersistentProperty(
|
||||||
new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version1"),
|
EntityWithMultipleVersionField.class.getDeclaredField("version1"), new PropertyDescriptor("version1",
|
||||||
new PropertyDescriptor("version1", EntityWithMultipleVersionField.class),
|
EntityWithMultipleVersionField.class),
|
||||||
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
||||||
new SimpleTypeHolder());
|
new SimpleTypeHolder());
|
||||||
|
|
||||||
SimpleElasticsearchPersistentProperty persistentProperty2 =
|
SimpleElasticsearchPersistentProperty persistentProperty2 = new SimpleElasticsearchPersistentProperty(
|
||||||
new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version2"),
|
EntityWithMultipleVersionField.class.getDeclaredField("version2"), new PropertyDescriptor("version2",
|
||||||
new PropertyDescriptor("version2", EntityWithMultipleVersionField.class),
|
EntityWithMultipleVersionField.class),
|
||||||
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
||||||
new SimpleTypeHolder());
|
new SimpleTypeHolder());
|
||||||
|
|
||||||
SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity(typeInformation);
|
SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity(
|
||||||
|
typeInformation);
|
||||||
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty1);
|
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty1);
|
||||||
// when
|
// when
|
||||||
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty2);
|
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class EntityWithWrongVersionType {
|
private class EntityWithWrongVersionType {
|
||||||
@Version
|
@Version
|
||||||
private String version;
|
private String version;
|
||||||
|
@ -32,6 +32,7 @@ import static org.apache.commons.lang.RandomStringUtils.randomNumeric;
|
|||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -66,7 +67,8 @@ public class CriteriaQueryTests {
|
|||||||
indexQuery.setObject(sampleEntity);
|
indexQuery.setObject(sampleEntity);
|
||||||
elasticsearchTemplate.index(indexQuery);
|
elasticsearchTemplate.index(indexQuery);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("test").and("message").contains("some"));
|
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("test").and("message")
|
||||||
|
.contains("some"));
|
||||||
// when
|
// when
|
||||||
SampleEntity sampleEntity1 = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
SampleEntity sampleEntity1 = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
@ -103,7 +105,8 @@ public class CriteriaQueryTests {
|
|||||||
indexQueries.add(indexQuery2);
|
indexQueries.add(indexQuery2);
|
||||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").or("message").contains("test"));
|
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").or("message")
|
||||||
|
.contains("test"));
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> page = elasticsearchTemplate.queryForPage(criteriaQuery, SampleEntity.class);
|
Page<SampleEntity> page = elasticsearchTemplate.queryForPage(criteriaQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
@ -137,7 +140,6 @@ public class CriteriaQueryTests {
|
|||||||
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldPerformOrOperationWithinCriteria() {
|
public void shouldPerformOrOperationWithinCriteria() {
|
||||||
// given
|
// given
|
||||||
@ -413,7 +415,8 @@ public class CriteriaQueryTests {
|
|||||||
|
|
||||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||||
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").startsWith("some").endsWith("search").contains("message").is("some message search"));
|
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").startsWith("some").endsWith("search")
|
||||||
|
.contains("message").is("some message search"));
|
||||||
// when
|
// when
|
||||||
SampleEntity sampleEntity = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
SampleEntity sampleEntity = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
||||||
// then
|
// then
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repositories;
|
package org.springframework.data.elasticsearch.repositories;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -38,6 +37,7 @@ import static org.apache.commons.lang.RandomStringUtils.randomNumeric;
|
|||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -109,7 +109,6 @@ public class CustomMethodRepositoryTests {
|
|||||||
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldExecuteCustomMethodWithLessThan() {
|
public void shouldExecuteCustomMethodWithLessThan() {
|
||||||
// given
|
// given
|
||||||
@ -425,7 +424,8 @@ public class CustomMethodRepositoryTests {
|
|||||||
repository.save(sampleEntity);
|
repository.save(sampleEntity);
|
||||||
}
|
}
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> pageResult = repository.findByMessage("message", new PageRequest(0, 23, new Sort(new Sort.Order(Sort.Direction.ASC,"message"))));
|
Page<SampleEntity> pageResult = repository.findByMessage("message", new PageRequest(0, 23, new Sort(new Sort.Order(
|
||||||
|
Sort.Direction.ASC, "message"))));
|
||||||
// then
|
// then
|
||||||
assertThat(pageResult.getTotalElements(), is(equalTo(30L)));
|
assertThat(pageResult.getTotalElements(), is(equalTo(30L)));
|
||||||
assertThat(pageResult.getContent().size(), is(equalTo(23)));
|
assertThat(pageResult.getContent().size(), is(equalTo(23)));
|
||||||
@ -455,13 +455,13 @@ public class CustomMethodRepositoryTests {
|
|||||||
sampleEntity.setVersion(System.currentTimeMillis());
|
sampleEntity.setVersion(System.currentTimeMillis());
|
||||||
repository.save(sampleEntity3);
|
repository.save(sampleEntity3);
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> pageResult = repository.findByMessageContaining("a", new PageRequest(0, 23, new Sort(new Sort.Order(Sort.Direction.DESC,"message"))));
|
Page<SampleEntity> pageResult = repository.findByMessageContaining("a", new PageRequest(0, 23, new Sort(
|
||||||
|
new Sort.Order(Sort.Direction.DESC, "message"))));
|
||||||
// then
|
// then
|
||||||
assertThat(pageResult.getContent().isEmpty(), is(false));
|
assertThat(pageResult.getContent().isEmpty(), is(false));
|
||||||
assertThat(pageResult.getContent().get(0).getMessage(), is(sampleEntity3.getMessage()));
|
assertThat(pageResult.getContent().get(0).getMessage(), is(sampleEntity3.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnListForMessage() {
|
public void shouldReturnListForMessage() {
|
||||||
// given
|
// given
|
||||||
@ -492,8 +492,4 @@ public class CustomMethodRepositoryTests {
|
|||||||
assertThat(sampleEntities.size(), is(1));
|
assertThat(sampleEntities.size(), is(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,4 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchRepository
|
|||||||
|
|
||||||
public interface DoubleIDRepository extends ElasticsearchRepository<DoubleIDEntity, Double> {
|
public interface DoubleIDRepository extends ElasticsearchRepository<DoubleIDEntity, Double> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repositories;
|
package org.springframework.data.elasticsearch.repositories;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.elasticsearch.SampleEntity;
|
import org.springframework.data.elasticsearch.SampleEntity;
|
||||||
@ -23,6 +22,7 @@ import org.springframework.data.elasticsearch.annotations.Query;
|
|||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch.repositories;
|
|||||||
|
|
||||||
import org.springframework.data.elasticsearch.SampleEntity;
|
import org.springframework.data.elasticsearch.SampleEntity;
|
||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repository.support;
|
package org.springframework.data.elasticsearch.repository.support;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -33,6 +32,7 @@ import org.springframework.data.repository.core.RepositoryMetadata;
|
|||||||
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
|
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
|
||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* @author Rizwan Idrees
|
||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
@ -53,8 +53,6 @@ public class ElasticsearchRepositoryFactoryTests {
|
|||||||
factory = new ElasticsearchRepositoryFactory(operations);
|
factory = new ElasticsearchRepositoryFactory(operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void shouldThrowExceptionGivenQueryDslRepository() {
|
public void shouldThrowExceptionGivenQueryDslRepository() {
|
||||||
// given
|
// given
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repository.support;
|
package org.springframework.data.elasticsearch.repository.support;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -52,7 +51,6 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
@Resource
|
@Resource
|
||||||
private SampleElasticsearchRepository repository;
|
private SampleElasticsearchRepository repository;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
repository.deleteAll();
|
repository.deleteAll();
|
||||||
@ -163,9 +161,7 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
sampleEntity.setVersion(System.currentTimeMillis());
|
sampleEntity.setVersion(System.currentTimeMillis());
|
||||||
repository.save(sampleEntity);
|
repository.save(sampleEntity);
|
||||||
|
|
||||||
SearchQuery query = new NativeSearchQueryBuilder()
|
SearchQuery query = new NativeSearchQueryBuilder().withQuery(termQuery("message", "test")).build();
|
||||||
.withQuery(termQuery("message", "test"))
|
|
||||||
.build();
|
|
||||||
// when
|
// when
|
||||||
Page<SampleEntity> page = repository.search(query);
|
Page<SampleEntity> page = repository.search(query);
|
||||||
// then
|
// then
|
||||||
@ -265,9 +261,7 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
sampleEntity.setVersion(System.currentTimeMillis());
|
sampleEntity.setVersion(System.currentTimeMillis());
|
||||||
repository.save(sampleEntity);
|
repository.save(sampleEntity);
|
||||||
// when
|
// when
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(fieldQuery("id", documentId)).build();
|
||||||
.withQuery(fieldQuery("id",documentId))
|
|
||||||
.build();
|
|
||||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||||
// then
|
// then
|
||||||
assertThat(sampleEntities.getTotalElements(), equalTo(1L));
|
assertThat(sampleEntities.getTotalElements(), equalTo(1L));
|
||||||
@ -278,9 +272,7 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
// when
|
// when
|
||||||
repository.deleteAll();
|
repository.deleteAll();
|
||||||
// then
|
// then
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||||
.withQuery(matchAllQuery())
|
|
||||||
.build();
|
|
||||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||||
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
||||||
}
|
}
|
||||||
@ -297,9 +289,7 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
// when
|
// when
|
||||||
repository.delete(sampleEntity);
|
repository.delete(sampleEntity);
|
||||||
// then
|
// then
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(fieldQuery("id", documentId)).build();
|
||||||
.withQuery(fieldQuery("id", documentId))
|
|
||||||
.build();
|
|
||||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||||
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
||||||
}
|
}
|
||||||
@ -390,21 +380,17 @@ public class SimpleElasticsearchRepositoryTests {
|
|||||||
@Test
|
@Test
|
||||||
public void shouldReturnSimilarEntities() {
|
public void shouldReturnSimilarEntities() {
|
||||||
// given
|
// given
|
||||||
String sampleMessage = "So we build a web site or an application and want to add search to it, " +
|
String sampleMessage = "So we build a web site or an application and want to add search to it, "
|
||||||
"and then it hits us: getting search working is hard. We want our search solution to be fast," +
|
+ "and then it hits us: getting search working is hard. We want our search solution to be fast,"
|
||||||
" we want a painless setup and a completely free search schema, we want to be able to index data simply using JSON over HTTP, " +
|
+ " we want a painless setup and a completely free search schema, we want to be able to index data simply using JSON over HTTP, "
|
||||||
"we want our search server to be always available, we want to be able to start with one machine and scale to hundreds, " +
|
+ "we want our search server to be always available, we want to be able to start with one machine and scale to hundreds, "
|
||||||
"we want real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
+ "we want real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<SampleEntity> sampleEntities = createSampleEntitiesWithMessage(sampleMessage, 30);
|
List<SampleEntity> sampleEntities = createSampleEntitiesWithMessage(sampleMessage, 30);
|
||||||
repository.save(sampleEntities);
|
repository.save(sampleEntities);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
SearchQuery searchQuery = new NativeSearchQueryBuilder().withPageable(new PageRequest(0, 5)).withFields("message")
|
||||||
.withPageable(new PageRequest(0, 5))
|
|
||||||
.withFields("message")
|
|
||||||
.build();
|
.build();
|
||||||
Page<SampleEntity> results = repository.searchSimilar(sampleEntities.get(0), searchQuery);
|
Page<SampleEntity> results = repository.searchSimilar(sampleEntities.get(0), searchQuery);
|
||||||
|
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
<import resource="infrastructure.xml" />
|
<import resource="infrastructure.xml" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories" />
|
<elasticsearch:repositories
|
||||||
|
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||||
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
<import resource="infrastructure.xml" />
|
<import resource="infrastructure.xml" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<elasticsearch:node-client id="client" local="true" cluster-name="testCluster" http-enabled="false" />
|
<elasticsearch:node-client id="client" local="true"
|
||||||
|
cluster-name="testCluster" http-enabled="false" />
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@ -5,15 +5,18 @@
|
|||||||
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<elasticsearch:node-client id="client" local="true" cluster-name="testCluster" http-enabled="false"/>
|
<elasticsearch:node-client id="client" local="true"
|
||||||
|
cluster-name="testCluster" http-enabled="false" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<elasticsearch:transport-client id="transportClient" />
|
<elasticsearch:transport-client id="transportClient" />
|
||||||
|
|
||||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories"/>
|
<elasticsearch:repositories
|
||||||
|
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||||
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
<import resource="infrastructure.xml" />
|
<import resource="infrastructure.xml" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
<import resource="infrastructure.xml" />
|
<import resource="infrastructure.xml" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
<import resource="infrastructure.xml" />
|
<import resource="infrastructure.xml" />
|
||||||
|
|
||||||
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
<bean name="elasticsearchTemplate"
|
||||||
|
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
|
||||||
<constructor-arg name="client" ref="client" />
|
<constructor-arg name="client" ref="client" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories"/>
|
<elasticsearch:repositories
|
||||||
|
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||||
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
Loading…
x
Reference in New Issue
Block a user