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"?>
|
||||
<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>
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
@ -154,12 +155,13 @@
|
||||
<scm>
|
||||
<url>https://github.com/SpringSource/spring-data-elasticsearch</url>
|
||||
<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>
|
||||
|
||||
<ciManagement>
|
||||
<system>Bamboo</system>
|
||||
<url>http://build.springsource.org/browse/SPRINGDATAESh</url>
|
||||
<url>http://build.springsource.org/browse/SPRINGDATAES</url>
|
||||
</ciManagement>
|
||||
|
||||
<issueManagement>
|
||||
|
@ -35,8 +35,10 @@
|
||||
<part id="reference">
|
||||
<title>Reference Documentation</title>
|
||||
|
||||
<xi:include 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
|
||||
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 href="reference/data-elasticsearch.xml" />
|
||||
|
@ -3,11 +3,14 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<preface id="preface">
|
||||
<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
|
||||
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
|
||||
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
|
||||
mongodb support in the Spring Framework.
|
||||
</para>
|
||||
@ -17,7 +20,8 @@
|
||||
<listitem>
|
||||
<para>
|
||||
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>
|
||||
</para>
|
||||
</listitem>
|
||||
@ -28,7 +32,8 @@
|
||||
<para>
|
||||
Requires
|
||||
<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>
|
||||
</section>
|
||||
</preface>
|
@ -15,8 +15,10 @@
|
||||
<title>Spring Namespace</title>
|
||||
|
||||
<para>
|
||||
The Spring Data Elasticsearch module contains a custom namespace allowing
|
||||
definition of repository beans as well as elements for instantiating
|
||||
The Spring Data Elasticsearch module contains a custom namespace
|
||||
allowing
|
||||
definition of repository beans as well as elements for
|
||||
instantiating
|
||||
a
|
||||
<classname>ElasticsearchServer</classname>
|
||||
.
|
||||
@ -87,12 +89,14 @@ http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.
|
||||
</section>
|
||||
<section id="elasticsearch.annotation">
|
||||
<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
|
||||
through JavaConfig.
|
||||
</para>
|
||||
<example>
|
||||
<title>Spring Data Elasticsearch repositories using JavaConfig</title>
|
||||
<title>Spring Data Elasticsearch repositories using JavaConfig
|
||||
</title>
|
||||
<programlisting language="java">
|
||||
@Configuration
|
||||
@EnableElasticsearchRepositories(basePackages = "org/springframework/data/elasticsearch/repositories")
|
||||
@ -122,11 +126,13 @@ return new ElasticsearchTemplate(nodeBuilder().local(true).node().client());
|
||||
</section>
|
||||
<section id="elasticsearch.cdi">
|
||||
<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.
|
||||
</para>
|
||||
<example>
|
||||
<title>Spring Data Elasticsearch repositories using JavaConfig</title>
|
||||
<title>Spring Data Elasticsearch repositories using JavaConfig
|
||||
</title>
|
||||
<programlisting language="java">class ElasticsearchTemplateProducer {
|
||||
|
||||
@Produces
|
||||
@ -157,9 +163,11 @@ public void setRepository(ProductRepository repository) {
|
||||
<section id="elasticsearch.query-methods.finders">
|
||||
<title>Query lookup strategies</title>
|
||||
<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
|
||||
it being derived from the method name.
|
||||
it being derived from the
|
||||
method name.
|
||||
</para>
|
||||
|
||||
<simplesect>
|
||||
@ -180,11 +188,13 @@ public void setRepository(ProductRepository repository) {
|
||||
<title>Query creation</title>
|
||||
|
||||
<para>
|
||||
Generally the query creation mechanism for Elasticsearch works as described
|
||||
Generally the query creation mechanism for Elasticsearch works as
|
||||
described
|
||||
in
|
||||
<xref linkend="repositories.query-methods" />
|
||||
. Here's a short example
|
||||
of what a Elasticsearch query method translates into:
|
||||
of what a Elasticsearch query method
|
||||
translates into:
|
||||
<example>
|
||||
<title>Query creation from method names</title>
|
||||
<programlisting language="java">public interface BookRepository extends Repository<Book, String> {
|
||||
@ -227,7 +237,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameAndPrice</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}</code>
|
||||
<code>{"bool" : {"must" : [ {"field" : {"name" : "?"}},
|
||||
{"field" : {"price" : "?"}} ]}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -238,7 +249,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameOrPrice</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}</code>
|
||||
<code>{"bool" : {"should" : [ {"field" : {"name" : "?"}},
|
||||
{"field" : {"price" : "?"}} ]}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -260,7 +272,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameNot</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must_not" : {"field" : {"name" : "?"}}}}</code>
|
||||
<code>{"bool" : {"must_not" : {"field" : {"name" : "?"}}}}
|
||||
</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -271,7 +284,9 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByPriceBetween</code>
|
||||
</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>
|
||||
</row>
|
||||
<row>
|
||||
@ -282,7 +297,9 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByPriceLessThan</code>
|
||||
</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>
|
||||
</row>
|
||||
<row>
|
||||
@ -293,7 +310,9 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByPriceGreaterThan</code>
|
||||
</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>
|
||||
</row>
|
||||
<row>
|
||||
@ -304,7 +323,9 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByPriceBefore</code>
|
||||
</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>
|
||||
</row>
|
||||
<row>
|
||||
@ -315,7 +336,9 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByPriceAfter</code>
|
||||
</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>
|
||||
</row>
|
||||
<row>
|
||||
@ -326,7 +349,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameLike</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||
"?*","analyze_wildcard" : true}}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -337,7 +361,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameStartingWith</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||
"?*","analyze_wildcard" : true}}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -348,7 +373,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameEndingWith</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "*?","analyze_wildcard" : true}}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||
"*?","analyze_wildcard" : true}}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -359,7 +385,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameContaining</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : "*?*","analyze_wildcard" : true}}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"name" : {"query" :
|
||||
"*?*","analyze_wildcard" : true}}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -370,7 +397,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameIn(Collection<String>names)</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}</code>
|
||||
<code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" :
|
||||
{"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -381,7 +409,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByNameNotIn(Collection<String>names)</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" : {"name" : "?"}}}}}}</code>
|
||||
<code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" :
|
||||
{"name" : "?"}}}}}}</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -403,7 +432,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByAvailableTrue</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"available" : true}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"available" : true}}}}
|
||||
</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -414,7 +444,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByAvailableFalse</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>{"bool" : {"must" : {"field" : {"available" : false}}}}</code>
|
||||
<code>{"bool" : {"must" : {"field" : {"available" : false}}}}
|
||||
</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -425,7 +456,8 @@ public void setRepository(ProductRepository repository) {
|
||||
<code>findByAvailableTrueOrderByNameDesc</code>
|
||||
</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>
|
||||
</row>
|
||||
</tbody>
|
||||
|
@ -8,7 +8,8 @@
|
||||
This chapter covers additional support for Elasticsearch operations
|
||||
that cannot be directly accessed via the repository
|
||||
interface.
|
||||
It is recommended to add those operations as custom
|
||||
It is
|
||||
recommended to add those operations as custom
|
||||
implementation as
|
||||
described in
|
||||
<xref linkend="repositories.custom-implementations" />
|
||||
@ -34,7 +35,8 @@ Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(sea
|
||||
<section id="elasticsearch.scan.and.scroll">
|
||||
<title>Using Scan And Scroll For Big Result Set</title>
|
||||
<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>
|
||||
has scan and scroll methods that can be used as below.
|
||||
</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
|
||||
@author Costin Leau
|
||||
*/
|
||||
|
||||
.hl-keyword {
|
||||
color: #7F0055;
|
||||
font-weight: bold;
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/css/html.css
|
||||
*/
|
||||
|
||||
@IMPORT url("highlight.css");
|
||||
|
||||
html {
|
||||
@ -12,7 +11,8 @@ html {
|
||||
body {
|
||||
margin-left: 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 {
|
||||
@ -31,7 +31,8 @@ hr {
|
||||
|
||||
h1,h2,h3,h4,h5 {
|
||||
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-top: 2em;
|
||||
}
|
||||
@ -85,7 +86,8 @@ div.table td {
|
||||
}
|
||||
|
||||
.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-style: italic;
|
||||
}
|
||||
@ -93,20 +95,23 @@ div.table td {
|
||||
p.releaseinfo {
|
||||
font-size: 100%;
|
||||
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;
|
||||
}
|
||||
|
||||
p.pubdate {
|
||||
font-size: 120%;
|
||||
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 {
|
||||
font-size: 200%;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
code {
|
||||
|
@ -1,19 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version="1.0">
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet" />
|
||||
<xsl:import href="highlight-fo.xsl" />
|
||||
|
||||
<!--###################################################
|
||||
Custom Title Page
|
||||
<!--################################################### Custom Title Page
|
||||
################################################### -->
|
||||
|
||||
<xsl:template name="book.titlepage.recto">
|
||||
@ -23,27 +18,32 @@
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<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" />
|
||||
</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" />
|
||||
</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" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<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" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<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:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
@ -51,16 +51,17 @@
|
||||
<xsl:value-of select="firstname" />
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="surname" />
|
||||
<!-- <xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="affiliation"/>
|
||||
<!-- <xsl:text> (</xsl:text> <xsl:value-of select="affiliation"/>
|
||||
<xsl:text>)</xsl:text> -->
|
||||
</xsl:for-each>
|
||||
</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>
|
||||
</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" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
@ -78,9 +79,7 @@
|
||||
<xsl:template name="book.titlepage.separator">
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Header
|
||||
################################################### -->
|
||||
<!--################################################### Header ################################################### -->
|
||||
|
||||
<!-- More space in the center header for long text -->
|
||||
<xsl:attribute-set name="header.content.properties">
|
||||
@ -91,9 +90,7 @@
|
||||
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Custom Footer
|
||||
################################################### -->
|
||||
<!--################################################### Custom Footer ################################################### -->
|
||||
<xsl:template name="footer.content">
|
||||
<xsl:param name="pageclass" select="''" />
|
||||
<xsl:param name="sequence" select="''" />
|
||||
@ -101,7 +98,9 @@
|
||||
<xsl:param name="gentext-key" select="''" />
|
||||
<xsl:variable name="Version">
|
||||
<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:variable>
|
||||
<xsl:choose>
|
||||
@ -110,7 +109,8 @@
|
||||
<xsl:value-of select="$Version" />
|
||||
</xsl:if>
|
||||
</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:choose>
|
||||
<xsl:when test="$sequence = 'even' and $position='left'">
|
||||
@ -124,7 +124,8 @@
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</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:choose>
|
||||
<xsl:when test="$position='center'">
|
||||
@ -138,19 +139,24 @@
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Extensions
|
||||
################################################### -->
|
||||
<!--################################################### Extensions ################################################### -->
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:param name="fop.extensions">1</xsl:param>
|
||||
<xsl:param name="fop1.extensions">1</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">0</xsl:param>
|
||||
<xsl:param name="fop.extensions">
|
||||
1
|
||||
</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 -->
|
||||
@ -159,51 +165,84 @@
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:param name="autotoc.label.separator" select="'. '" />
|
||||
|
||||
|
||||
<!--###################################################
|
||||
Paper & Page Size
|
||||
<!--################################################### Paper & Page Size
|
||||
################################################### -->
|
||||
|
||||
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
||||
<xsl:param name="paper.type" select="'A4'" />
|
||||
<xsl:param name="double.sided">0</xsl:param>
|
||||
<xsl:param name="headers.on.blank.pages">0</xsl:param>
|
||||
<xsl:param name="footers.on.blank.pages">0</xsl:param>
|
||||
<xsl:param name="double.sided">
|
||||
0
|
||||
</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) -->
|
||||
<xsl:param name="page.margin.top">5mm</xsl:param>
|
||||
<xsl:param name="region.before.extent">10mm</xsl:param>
|
||||
<xsl:param name="body.margin.top">10mm</xsl:param>
|
||||
<xsl:param name="page.margin.top">
|
||||
5mm
|
||||
</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="region.after.extent">10mm</xsl:param>
|
||||
<xsl:param name="page.margin.bottom">0mm</xsl:param>
|
||||
<xsl:param name="body.margin.bottom">
|
||||
15mm
|
||||
</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.inner">18mm</xsl:param>
|
||||
<xsl:param name="page.margin.outer">
|
||||
18mm
|
||||
</xsl:param>
|
||||
<xsl:param name="page.margin.inner">
|
||||
18mm
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:param name="alignment">justify</xsl:param>
|
||||
<xsl:param name="hyphenate">false</xsl:param>
|
||||
<xsl:param name="alignment">
|
||||
justify
|
||||
</xsl:param>
|
||||
<xsl:param name="hyphenate">
|
||||
false
|
||||
</xsl:param>
|
||||
|
||||
<!-- Default Font size -->
|
||||
<xsl:param name="body.font.master">11</xsl:param>
|
||||
<xsl:param name="body.font.small">8</xsl:param>
|
||||
<xsl:param name="body.font.master">
|
||||
11
|
||||
</xsl:param>
|
||||
<xsl:param name="body.font.small">
|
||||
8
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:attribute-set name="monospace.properties">
|
||||
@ -213,12 +252,12 @@
|
||||
<xsl:attribute name="font-size">0.8em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Tables
|
||||
################################################### -->
|
||||
<!--################################################### Tables ################################################### -->
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:attribute-set name="table.cell.padding">
|
||||
@ -229,21 +268,24 @@
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Only hairlines as frame and cell borders in tables -->
|
||||
<xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
|
||||
<xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
|
||||
<xsl:param name="table.frame.border.thickness">
|
||||
0.1pt
|
||||
</xsl:param>
|
||||
<xsl:param name="table.cell.border.thickness">
|
||||
0.1pt
|
||||
</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
<!--################################################### Labels ################################################### -->
|
||||
|
||||
<!-- 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.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="section.label.includes.component.label"
|
||||
select="1" />
|
||||
|
||||
<!--###################################################
|
||||
Titles
|
||||
################################################### -->
|
||||
<!--################################################### Titles ################################################### -->
|
||||
|
||||
<!-- Chapter title size -->
|
||||
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
||||
@ -305,7 +347,8 @@
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- 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-size">
|
||||
<xsl:value-of select="$body.font.master" />
|
||||
@ -317,8 +360,7 @@
|
||||
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Programlistings
|
||||
<!--################################################### Programlistings
|
||||
################################################### -->
|
||||
|
||||
<!-- Verbatim text formatting (programlistings) -->
|
||||
@ -345,33 +387,39 @@
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- 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 name="background-color">#F0F0F0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
<!--################################################### Callouts ################################################### -->
|
||||
|
||||
<!-- Use images for callouts instead of (1) (2) (3) -->
|
||||
<xsl:param name="callout.graphics">0</xsl:param>
|
||||
<xsl:param name="callout.unicode">1</xsl:param>
|
||||
<xsl:param name="callout.graphics">
|
||||
0
|
||||
</xsl:param>
|
||||
<xsl:param name="callout.unicode">
|
||||
1
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:param name="admon.graphics">'1'</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">src/docbkx/resources/images/admons/</xsl:param>
|
||||
<xsl:param name="admon.graphics">
|
||||
'1'
|
||||
</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">
|
||||
src/docbkx/resources/images/admons/
|
||||
</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
<!--################################################### Misc ################################################### -->
|
||||
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
@ -383,7 +431,9 @@
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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 -->
|
||||
<xsl:attribute-set name="list.block.spacing">
|
||||
@ -395,13 +445,11 @@
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
colored and hyphenated links
|
||||
################################################### -->
|
||||
<!--################################################### colored and hyphenated
|
||||
links ################################################### -->
|
||||
<xsl:template match="ulink">
|
||||
<fo:basic-link external-destination="{@url}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
xsl:use-attribute-sets="xref.properties" text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
@ -416,8 +464,7 @@
|
||||
|
||||
<xsl:template match="link">
|
||||
<fo:basic-link internal-destination="{@linkend}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
xsl:use-attribute-sets="xref.properties" text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
|
@ -1,45 +1,57 @@
|
||||
<?xml version='1.0'?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl" version='1.0'>
|
||||
|
||||
<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 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 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 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 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 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 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 match='xslthl:string'>
|
||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
||||
<fo:inline color="#2A00FF">
|
||||
<xsl:apply-templates />
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,43 +1,56 @@
|
||||
<?xml version='1.0'?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
xmlns:xslthl="http://xslthl.sf.net" exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<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 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 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 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 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 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 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 match='xslthl:string'>
|
||||
<span class="hl-string"><xsl:value-of select='.'/></span>
|
||||
<span class="hl-string">
|
||||
<xsl:value-of select='.' />
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,29 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version="1.0">
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl" version="1.0">
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet" />
|
||||
<xsl:import href="highlight.xsl" />
|
||||
|
||||
<!--###################################################
|
||||
HTML Settings
|
||||
################################################### -->
|
||||
<!--################################################### HTML Settings ################################################### -->
|
||||
|
||||
<!-- These extensions are required for table printing and other stuff -->
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">
|
||||
0
|
||||
</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 -->
|
||||
@ -32,37 +30,42 @@
|
||||
</xsl:param>
|
||||
|
||||
<!-- 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) -->
|
||||
<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.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) -->
|
||||
<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 -->
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
<xsl:param name="callout.defaultcolumn">
|
||||
90
|
||||
</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Admonitions
|
||||
################################################### -->
|
||||
<!--################################################### Admonitions ################################################### -->
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">1</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
<xsl:param name="admon.graphics">
|
||||
1
|
||||
</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">
|
||||
images/admons/
|
||||
</xsl:param>
|
||||
<!--################################################### Misc ################################################### -->
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
@ -78,7 +81,8 @@
|
||||
<span class="{name(.)}">
|
||||
<xsl:call-template name="person.name" />
|
||||
<!-- (<xsl:value-of select="affiliation"/>) -->
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
||||
<xsl:apply-templates mode="titlepage.mode"
|
||||
select="./contrib" />
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||
@ -88,18 +92,20 @@
|
||||
<xsl:apply-templates mode="titlepage.mode" />
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!--###################################################
|
||||
Headers and Footers
|
||||
<!--################################################### Headers and Footers
|
||||
################################################### -->
|
||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||
<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/"
|
||||
title="The Spring Framework - Spring Data">
|
||||
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
||||
</a>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/"
|
||||
title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;"
|
||||
src="images/s2-banner-rhs.png" />
|
||||
</a>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
@ -1,26 +1,30 @@
|
||||
<?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
|
||||
This is the XSL HTML configuration file for the Spring Reference Documentation.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version="1.0">
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet" />
|
||||
<xsl:import href="highlight.xsl" />
|
||||
|
||||
|
||||
<!--###################################################
|
||||
HTML Settings
|
||||
################################################### -->
|
||||
<xsl:param name="chunk.section.depth">'5'</xsl:param>
|
||||
<xsl:param name="use.id.as.filename">'1'</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
<!--###################################################
|
||||
Table Of Contents
|
||||
<!--################################################### HTML Settings ################################################### -->
|
||||
<xsl:param name="chunk.section.depth">
|
||||
'5'
|
||||
</xsl:param>
|
||||
<xsl:param name="use.id.as.filename">
|
||||
'1'
|
||||
</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">
|
||||
0
|
||||
</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 -->
|
||||
<xsl:param name="generate.toc">
|
||||
@ -28,31 +32,36 @@
|
||||
qandaset toc
|
||||
</xsl:param>
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
<xsl:param name="toc.section.depth">
|
||||
3
|
||||
</xsl:param>
|
||||
<!--################################################### Labels ################################################### -->
|
||||
<!-- 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.label.includes.component.label" select="1"/>
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
<xsl:param name="section.label.includes.component.label"
|
||||
select="1" />
|
||||
<!--################################################### Callouts ################################################### -->
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.graphics">1</xsl:param>
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
<xsl:param name="callout.graphics">
|
||||
1
|
||||
</xsl:param>
|
||||
<xsl:param name="callout.defaultcolumn">
|
||||
90
|
||||
</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Admonitions
|
||||
################################################### -->
|
||||
<!--################################################### Admonitions ################################################### -->
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">1</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
<xsl:param name="admon.graphics">
|
||||
1
|
||||
</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">
|
||||
images/admons/
|
||||
</xsl:param>
|
||||
<!--################################################### Misc ################################################### -->
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
@ -67,11 +76,12 @@
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:call-template name="person.name" />
|
||||
(<xsl:value-of select="affiliation"/>)
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
||||
<!--
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./affiliation"/>
|
||||
-->
|
||||
(
|
||||
<xsl:value-of select="affiliation" />
|
||||
)
|
||||
<xsl:apply-templates mode="titlepage.mode"
|
||||
select="./contrib" />
|
||||
<!-- <xsl:apply-templates mode="titlepage.mode" select="./affiliation"/> -->
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||
@ -81,41 +91,49 @@
|
||||
<xsl:apply-templates mode="titlepage.mode" />
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!--###################################################
|
||||
Headers and Footers
|
||||
<!--################################################### Headers and Footers
|
||||
################################################### -->
|
||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||
<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/"
|
||||
title="The Spring Framework - Spring Data">
|
||||
<img style="border:none;" src="images/xdev-spring_logo.jpg" />
|
||||
</a>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/"
|
||||
title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;"
|
||||
src="images/s2-banner-rhs.png" />
|
||||
</a>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!-- no other header navigation (prev, next, etc.) -->
|
||||
<xsl:template name="header.navigation" />
|
||||
<xsl:param name="navig.showtitles">1</xsl:param>
|
||||
<!-- let's have a 'Sponsored by SpringSource' strapline (or somesuch) across the bottom of each page -->
|
||||
<xsl:param name="navig.showtitles">
|
||||
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:param name="prev" select="/foo" />
|
||||
<xsl:param name="next" select="/foo" />
|
||||
<xsl:param name="nav.context" />
|
||||
<xsl:variable name="home" select="/*[1]" />
|
||||
<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($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 $nav.context = 'toc')
|
||||
or ($chunk.tocs.and.lots != 0
|
||||
and $nav.context != 'toc')
|
||||
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">
|
||||
<xsl:if test="$footer.rule != 0">
|
||||
<hr />
|
||||
@ -128,8 +146,10 @@
|
||||
<xsl:if test="count($prev)>0">
|
||||
<a accesskey="p">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$prev"/>
|
||||
<xsl:call-template
|
||||
name="href.target">
|
||||
<xsl:with-param
|
||||
name="object" select="$prev" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
@ -145,8 +165,10 @@
|
||||
<xsl:when test="$home != . or $nav.context = 'toc'">
|
||||
<a accesskey="h">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$home"/>
|
||||
<xsl:call-template
|
||||
name="href.target">
|
||||
<xsl:with-param
|
||||
name="object" select="$home" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
@ -157,16 +179,21 @@
|
||||
<xsl:text> | </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> </xsl:otherwise>
|
||||
<xsl:otherwise>
|
||||
 
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
||||
<a accesskey="t">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
|
||||
<xsl:with-param name="recursive" select="true()"/>
|
||||
<xsl:apply-templates
|
||||
select="/*[1]" mode="recursive-chunk-filename">
|
||||
<xsl:with-param
|
||||
name="recursive" select="true()" />
|
||||
</xsl:apply-templates>
|
||||
<xsl:text>-toc</xsl:text>
|
||||
<xsl:value-of select="$html.ext"/>
|
||||
<xsl:value-of
|
||||
select="$html.ext" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="gentext">
|
||||
<xsl:with-param name="key" select="'nav-toc'" />
|
||||
@ -179,8 +206,10 @@
|
||||
<xsl:if test="count($next)>0">
|
||||
<a accesskey="n">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$next"/>
|
||||
<xsl:call-template
|
||||
name="href.target">
|
||||
<xsl:with-param
|
||||
name="object" select="$next" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
@ -195,21 +224,23 @@
|
||||
<tr>
|
||||
<td width="40%" align="left" valign="top">
|
||||
<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:text> </xsl:text>
|
||||
</td>
|
||||
<td width="20%" align="center">
|
||||
<span style="color:white;font-size:90%;">
|
||||
<a href="http://www.SpringSource.com/"
|
||||
title="SpringSource - Spring from the Source">Sponsored by SpringSource
|
||||
<a href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">Sponsored by
|
||||
SpringSource
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
<td width="40%" align="right" valign="top">
|
||||
<xsl:text> </xsl:text>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,10 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly>
|
||||
<!-- distribution assembly descriptor. packages up jars, source jars, documentation,
|
||||
dependencies and other resources into a single archive suitable for download and
|
||||
standalone use.
|
||||
see pom.xml 'maven-assembly-plugin' declaration
|
||||
see src/main/scripts/build-distribution.sh
|
||||
dependencies and other resources into a single archive suitable for download
|
||||
and standalone use. 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 -->
|
||||
<id>distribution</id>
|
||||
<formats>
|
||||
@ -24,15 +22,14 @@
|
||||
<lineEnding>dos</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<!-- adds reference manual (html and pdf) to the distribution archive under the
|
||||
'docs/reference' directory
|
||||
see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||
<!-- adds reference manual (html and pdf) to the distribution archive
|
||||
under the 'docs/reference' directory see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||
<directory>target/site/reference</directory>
|
||||
<outputDirectory>docs/reference</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<!-- adds javadoc html to the distribution archive under the 'docs/javadoc' directory
|
||||
see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||
<!-- adds javadoc html to the distribution archive under the 'docs/javadoc'
|
||||
directory see pom.xml 'maven-javadoc-plugin' declaration -->
|
||||
<directory>target/site/apidocs</directory>
|
||||
<outputDirectory>docs/javadoc</outputDirectory>
|
||||
</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"
|
||||
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>
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.annotations;
|
||||
|
||||
|
||||
import org.springframework.data.annotation.Persistent;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
@ -34,9 +33,14 @@ import java.lang.annotation.*;
|
||||
public @interface Document {
|
||||
|
||||
String indexName();
|
||||
|
||||
String type() default "";
|
||||
|
||||
short shards() default 1;
|
||||
|
||||
short replicas() default 5;
|
||||
|
||||
String refreshInterval() default "1s";
|
||||
|
||||
String indexStoreType() default "fs";
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ package org.springframework.data.elasticsearch.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -28,9 +27,13 @@ import java.lang.annotation.*;
|
||||
public @interface Field {
|
||||
|
||||
String type() default "";
|
||||
|
||||
String index() default "";
|
||||
|
||||
boolean store() default false;
|
||||
|
||||
String searchAnalyzer() default "";
|
||||
|
||||
String indexAnalyzer() default "";
|
||||
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ public class NodeClientFactoryBean implements FactoryBean<NodeClient>, Initializ
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
.put("http.enabled", String.valueOf(this.enableHttp));
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder().put("http.enabled",
|
||||
String.valueOf(this.enableHttp));
|
||||
|
||||
nodeClient = (NodeClient) nodeBuilder().settings(settings)
|
||||
.clusterName(this.clusterName).local(this.local).node().client();
|
||||
nodeClient = (NodeClient) nodeBuilder().settings(settings).clusterName(this.clusterName).local(this.local).node()
|
||||
.client();
|
||||
}
|
||||
|
||||
public void setLocal(boolean local) {
|
||||
|
@ -96,8 +96,7 @@ public class TransportClientFactoryBean implements FactoryBean<TransportClient>,
|
||||
if (properties != null) {
|
||||
return settingsBuilder().put(properties).build();
|
||||
}
|
||||
return settingsBuilder()
|
||||
.put("client.transport.sniff",true).build();
|
||||
return settingsBuilder().put("client.transport.sniff", true).build();
|
||||
}
|
||||
|
||||
public void setClusterNodes(String[] clusterNodes) {
|
||||
|
@ -45,7 +45,6 @@ public class NodeClientBeanDefinitionParser extends AbstractBeanDefinitionParser
|
||||
builder.addPropertyValue("enableHttp", Boolean.valueOf(element.getAttribute("http-enabled")));
|
||||
}
|
||||
|
||||
|
||||
private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
|
||||
ParserContext context) {
|
||||
AbstractBeanDefinition definition = builder.getBeanDefinition();
|
||||
|
@ -23,6 +23,7 @@ import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.split;
|
||||
|
||||
/**
|
||||
* TransportClientBeanDefinitionParser
|
||||
*
|
||||
|
@ -35,7 +35,6 @@ import static org.springframework.data.elasticsearch.core.query.Criteria.Operati
|
||||
*/
|
||||
class CriteriaQueryProcessor {
|
||||
|
||||
|
||||
QueryBuilder createQueryFromCriteria(Criteria criteria) {
|
||||
BoolQueryBuilder query = boolQuery();
|
||||
|
||||
@ -53,7 +52,6 @@ class CriteriaQueryProcessor {
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
private QueryBuilder createQueryFragmentForCriteria(Criteria chainedCriteria) {
|
||||
Iterator<Criteria.CriteriaEntry> it = chainedCriteria.getCriteriaEntries().iterator();
|
||||
boolean singeEntryCriteria = (chainedCriteria.getCriteriaEntries().size() == 1);
|
||||
@ -77,7 +75,6 @@ class CriteriaQueryProcessor {
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String fieldName) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
@ -86,20 +83,27 @@ class CriteriaQueryProcessor {
|
||||
|
||||
switch (key) {
|
||||
case EQUALS:
|
||||
query = fieldQuery(fieldName, value); break;
|
||||
query = fieldQuery(fieldName, value);
|
||||
break;
|
||||
case CONTAINS:
|
||||
query = fieldQuery(fieldName,"*" + value + "*").analyzeWildcard(true); break;
|
||||
query = fieldQuery(fieldName, "*" + value + "*").analyzeWildcard(true);
|
||||
break;
|
||||
case STARTS_WITH:
|
||||
query = fieldQuery(fieldName,value +"*").analyzeWildcard(true); break;
|
||||
query = fieldQuery(fieldName, value + "*").analyzeWildcard(true);
|
||||
break;
|
||||
case ENDS_WITH:
|
||||
query = fieldQuery(fieldName, "*"+value).analyzeWildcard(true); break;
|
||||
query = fieldQuery(fieldName, "*" + value).analyzeWildcard(true);
|
||||
break;
|
||||
case EXPRESSION:
|
||||
query = queryString((String)value).field(fieldName); break;
|
||||
query = queryString((String) value).field(fieldName);
|
||||
break;
|
||||
case BETWEEN:
|
||||
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:
|
||||
query = fuzzyQuery(fieldName, (String) value); break;
|
||||
query = fuzzyQuery(fieldName, (String) value);
|
||||
break;
|
||||
case IN:
|
||||
query = boolQuery();
|
||||
Iterable<Object> collection = (Iterable<Object>) value;
|
||||
@ -130,5 +134,4 @@ class CriteriaQueryProcessor {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core;
|
||||
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
|
||||
import org.springframework.data.elasticsearch.core.query.*;
|
||||
@ -30,7 +29,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface ElasticsearchOperations {
|
||||
|
||||
|
||||
/**
|
||||
* @return Converter in use
|
||||
*/
|
||||
@ -38,6 +36,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Create an index for a class
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
*/
|
||||
@ -45,12 +44,12 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Create mapping for a class
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
*/
|
||||
<T> boolean putMapping(Class<T> clazz);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
* Execute the query against elasticsearch and return result as {@link Page}
|
||||
*
|
||||
@ -192,6 +186,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Delete all records matching the query
|
||||
*
|
||||
* @param clazz
|
||||
* @param query
|
||||
*/
|
||||
@ -199,6 +194,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Deletes an index for given entity
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
@ -207,6 +203,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* check if index is exists
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
@ -215,6 +212,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* refresh the index
|
||||
*
|
||||
* @param indexName
|
||||
* @param waitForOperation
|
||||
*/
|
||||
@ -222,6 +220,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* refresh the index
|
||||
*
|
||||
* @param clazz
|
||||
* @param waitForOperation
|
||||
*/
|
||||
@ -229,6 +228,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Returns scroll id for scan query
|
||||
*
|
||||
* @param query
|
||||
* @param scrollTimeInMillis
|
||||
* @param noFields
|
||||
@ -238,6 +238,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* Scrolls the results for give scroll id
|
||||
*
|
||||
* @param scrollId
|
||||
* @param scrollTimeInMillis
|
||||
* @param resultsMapper
|
||||
@ -248,6 +249,7 @@ public interface ElasticsearchOperations {
|
||||
|
||||
/**
|
||||
* more like this query to search for documents that are "like" a specific document.
|
||||
*
|
||||
* @param query
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
|
@ -90,7 +90,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
|
||||
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter) {
|
||||
this.client = client;
|
||||
this.elasticsearchConverter = (elasticsearchConverter == null)? new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()) : elasticsearchConverter ;
|
||||
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
|
||||
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,11 +103,12 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
@Override
|
||||
public <T> boolean putMapping(Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||
PutMappingRequestBuilder requestBuilder = client.admin().indices().preparePutMapping(persistentEntity.getIndexName())
|
||||
.setType(persistentEntity.getIndexType());
|
||||
PutMappingRequestBuilder requestBuilder = client.admin().indices()
|
||||
.preparePutMapping(persistentEntity.getIndexName()).setType(persistentEntity.getIndexType());
|
||||
|
||||
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();
|
||||
} catch (Exception e) {
|
||||
throw new ElasticsearchException("Failed to build mapping for " + clazz.getSimpleName(), e);
|
||||
@ -121,8 +123,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
@Override
|
||||
public <T> T queryForObject(GetQuery query, Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||
GetResponse response = client.prepareGet(persistentEntity.getIndexName(), persistentEntity.getIndexType(), query.getId())
|
||||
.execute().actionGet();
|
||||
GetResponse response = client
|
||||
.prepareGet(persistentEntity.getIndexName(), persistentEntity.getIndexType(), query.getId()).execute()
|
||||
.actionGet();
|
||||
return mapResult(response.getSourceAsString(), clazz);
|
||||
}
|
||||
|
||||
@ -142,13 +145,15 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
|
||||
@Override
|
||||
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());
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@ -162,11 +167,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
return queryForPage(query, clazz).getContent();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> List<String> queryForIds(SearchQuery query) {
|
||||
SearchRequestBuilder request = prepareSearch(query).setQuery(query.getQuery())
|
||||
.setNoFields();
|
||||
SearchRequestBuilder request = prepareSearch(query).setQuery(query.getQuery()).setNoFields();
|
||||
if (query.getFilter() != null) {
|
||||
request.setFilter(query.getFilter());
|
||||
}
|
||||
@ -177,25 +180,21 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
@Override
|
||||
public <T> Page<T> queryForPage(CriteriaQuery criteriaQuery, Class<T> clazz) {
|
||||
QueryBuilder query = new CriteriaQueryProcessor().createQueryFromCriteria(criteriaQuery.getCriteria());
|
||||
SearchResponse response = prepareSearch(criteriaQuery,clazz)
|
||||
.setQuery(query)
|
||||
.execute().actionGet();
|
||||
SearchResponse response = prepareSearch(criteriaQuery, clazz).setQuery(query).execute().actionGet();
|
||||
return mapResults(response, clazz, criteriaQuery.getPageable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Page<T> queryForPage(StringQuery query, Class<T> clazz) {
|
||||
SearchResponse response = prepareSearch(query,clazz)
|
||||
.setQuery(query.getSource())
|
||||
.execute().actionGet();
|
||||
SearchResponse response = prepareSearch(query, clazz).setQuery(query.getSource()).execute().actionGet();
|
||||
return mapResults(response, clazz, query.getPageable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> long count(SearchQuery query, Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||
CountRequestBuilder countRequestBuilder = client.prepareCount(persistentEntity.getIndexName())
|
||||
.setTypes(persistentEntity.getIndexType());
|
||||
CountRequestBuilder countRequestBuilder = client.prepareCount(persistentEntity.getIndexName()).setTypes(
|
||||
persistentEntity.getIndexType());
|
||||
if (query.getQuery() != null) {
|
||||
countRequestBuilder.setQuery(query.getQuery());
|
||||
}
|
||||
@ -204,9 +203,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
|
||||
@Override
|
||||
public String index(IndexQuery query) {
|
||||
return prepareIndex(query)
|
||||
.execute()
|
||||
.actionGet().getId();
|
||||
return prepareIndex(query).execute().actionGet().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -222,7 +219,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
if (item.isFailed())
|
||||
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
|
||||
public String delete(String indexName, String type, String id) {
|
||||
return client.prepareDelete(indexName, type, id)
|
||||
.execute().actionGet().getId();
|
||||
return client.prepareDelete(indexName, type, id).execute().actionGet().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -255,10 +253,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
@Override
|
||||
public <T> void delete(DeleteQuery deleteQuery, Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz);
|
||||
client.prepareDeleteByQuery(persistentEntity.getIndexName())
|
||||
.setTypes(persistentEntity.getIndexType())
|
||||
.setQuery(deleteQuery.getQuery())
|
||||
.execute().actionGet();
|
||||
client.prepareDeleteByQuery(persistentEntity.getIndexName()).setTypes(persistentEntity.getIndexType())
|
||||
.setQuery(deleteQuery.getQuery()).execute().actionGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -267,12 +263,9 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
Assert.notNull(searchQuery.getTypes(), "No type define for Query");
|
||||
Assert.notNull(searchQuery.getPageable(), "Query.pageable is required for scan & scroll");
|
||||
|
||||
SearchRequestBuilder requestBuilder = client.prepareSearch(toArray(searchQuery.getIndices()))
|
||||
.setSearchType(SCAN)
|
||||
.setQuery(searchQuery.getQuery())
|
||||
.setTypes(toArray(searchQuery.getTypes()))
|
||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis))
|
||||
.setFrom(0)
|
||||
SearchRequestBuilder requestBuilder = client.prepareSearch(toArray(searchQuery.getIndices())).setSearchType(SCAN)
|
||||
.setQuery(searchQuery.getQuery()).setTypes(toArray(searchQuery.getTypes()))
|
||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis)).setFrom(0)
|
||||
.setSize(searchQuery.getPageable().getPageSize());
|
||||
|
||||
if (searchQuery.getFilter() != null) {
|
||||
@ -288,8 +281,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
@Override
|
||||
public <T> Page<T> scroll(String scrollId, long scrollTimeInMillis, ResultsMapper<T> resultsMapper) {
|
||||
SearchResponse response = client.prepareSearchScroll(scrollId)
|
||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis))
|
||||
.execute().actionGet();
|
||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis)).execute().actionGet();
|
||||
return resultsMapper.mapResults(response);
|
||||
}
|
||||
|
||||
@ -304,8 +296,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
Assert.notNull(type, "No 'type' defined for MoreLikeThisQuery");
|
||||
Assert.notNull(query.getId(), "No document id defined for MoreLikeThisQuery");
|
||||
|
||||
MoreLikeThisRequestBuilder requestBuilder =
|
||||
client.prepareMoreLikeThis(indexName,type, query.getId());
|
||||
MoreLikeThisRequestBuilder requestBuilder = client.prepareMoreLikeThis(indexName, type, query.getId());
|
||||
|
||||
if (query.getPageable() != null) {
|
||||
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
||||
@ -357,7 +348,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
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) {
|
||||
searchRequest.setFilter(filter);
|
||||
}
|
||||
@ -374,24 +366,21 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
}
|
||||
|
||||
private boolean indexExists(String indexName) {
|
||||
return client.admin()
|
||||
.indices()
|
||||
.exists(indicesExistsRequest(indexName)).actionGet().isExists();
|
||||
return client.admin().indices().exists(indicesExistsRequest(indexName)).actionGet().isExists();
|
||||
}
|
||||
|
||||
private <T> boolean createIndexWithSettings(Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||
return client.admin().indices().create(Requests.createIndexRequest(persistentEntity.getIndexName()).
|
||||
settings(getSettings(persistentEntity))).actionGet().isAcknowledged();
|
||||
return client.admin().indices()
|
||||
.create(Requests.createIndexRequest(persistentEntity.getIndexName()).settings(getSettings(persistentEntity)))
|
||||
.actionGet().isAcknowledged();
|
||||
}
|
||||
|
||||
private <T> Map getSettings(ElasticsearchPersistentEntity<T> persistentEntity) {
|
||||
return new MapBuilder<String, String>()
|
||||
.put("index.number_of_shards", String.valueOf(persistentEntity.getShards()))
|
||||
return new MapBuilder<String, String>().put("index.number_of_shards", String.valueOf(persistentEntity.getShards()))
|
||||
.put("index.number_of_replicas", String.valueOf(persistentEntity.getReplicas()))
|
||||
.put("index.refresh_interval", persistentEntity.getRefreshInterval())
|
||||
.put("index.store.type", persistentEntity.getIndexStoreType())
|
||||
.map();
|
||||
.put("index.store.type", persistentEntity.getIndexStoreType()).map();
|
||||
}
|
||||
|
||||
private <T> SearchRequestBuilder prepareSearch(Query query, Class<T> clazz) {
|
||||
@ -410,8 +399,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
|
||||
int startRecord = 0;
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(toArray(query.getIndices()))
|
||||
.setSearchType(DFS_QUERY_THEN_FETCH)
|
||||
.setTypes(toArray(query.getTypes()));
|
||||
.setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
|
||||
|
||||
if (query.getPageable() != null) {
|
||||
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
|
||||
@ -419,14 +407,14 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
}
|
||||
searchRequestBuilder.setFrom(startRecord);
|
||||
|
||||
|
||||
if (!query.getFields().isEmpty()) {
|
||||
searchRequestBuilder.addFields(toArray(query.getFields()));
|
||||
}
|
||||
|
||||
if (query.getSort() != null) {
|
||||
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;
|
||||
@ -434,13 +422,13 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
|
||||
private IndexRequestBuilder prepareIndex(IndexQuery query) {
|
||||
try {
|
||||
String indexName = isBlank(query.getIndexName())?
|
||||
retrieveIndexNameFromPersistentEntity(query.getObject().getClass())[0] : query.getIndexName();
|
||||
String type = isBlank(query.getType())?
|
||||
retrieveTypeFromPersistentEntity(query.getObject().getClass())[0] : query.getType();
|
||||
String indexName = isBlank(query.getIndexName()) ? retrieveIndexNameFromPersistentEntity(query.getObject()
|
||||
.getClass())[0] : query.getIndexName();
|
||||
String type = isBlank(query.getType()) ? retrieveTypeFromPersistentEntity(query.getObject().getClass())[0]
|
||||
: query.getType();
|
||||
|
||||
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(indexName,type,query.getId())
|
||||
.setSource(objectMapper.writeValueAsString(query.getObject()));
|
||||
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(indexName, type, query.getId()).setSource(
|
||||
objectMapper.writeValueAsString(query.getObject()));
|
||||
|
||||
if (query.getVersion() != null) {
|
||||
indexRequestBuilder.setVersion(query.getVersion());
|
||||
@ -453,8 +441,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
}
|
||||
|
||||
public void refresh(String indexName, boolean waitForOperation) {
|
||||
client.admin().indices()
|
||||
.refresh(refreshRequest(indexName).waitForOperations(waitForOperation)).actionGet();
|
||||
client.admin().indices().refresh(refreshRequest(indexName).waitForOperations(waitForOperation)).actionGet();
|
||||
}
|
||||
|
||||
public <T> void refresh(Class<T> clazz, boolean waitForOperation) {
|
||||
@ -464,8 +451,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
}
|
||||
|
||||
private ElasticsearchPersistentEntity getPersistentEntityFor(Class clazz) {
|
||||
Assert.isTrue(clazz.isAnnotationPresent(Document.class), "Unable to identify index name. " +
|
||||
clazz.getSimpleName() + " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")");
|
||||
Assert.isTrue(clazz.isAnnotationPresent(Document.class), "Unable to identify index name. " + clazz.getSimpleName()
|
||||
+ " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")");
|
||||
return elasticsearchConverter.getMappingContext().getPersistentEntity(clazz);
|
||||
}
|
||||
|
||||
@ -522,4 +509,3 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core;
|
||||
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.springframework.data.elasticsearch.annotations.Field;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
@ -39,26 +38,20 @@ class MappingBuilder {
|
||||
private static SimpleTypeHolder SIMPLE_TYPE_HOLDER = new SimpleTypeHolder();
|
||||
|
||||
static XContentBuilder buildMapping(Class clazz, String indexType, String idFieldName) throws IOException {
|
||||
XContentBuilder xContentBuilder = jsonBuilder()
|
||||
.startObject().startObject(indexType).startObject("properties");
|
||||
XContentBuilder xContentBuilder = jsonBuilder().startObject().startObject(indexType).startObject("properties");
|
||||
|
||||
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY);
|
||||
|
||||
return xContentBuilder.endObject().endObject().endObject();
|
||||
}
|
||||
|
||||
private static void mapEntity(XContentBuilder xContentBuilder,
|
||||
Class clazz,
|
||||
boolean isRootObject,
|
||||
String idFieldName,
|
||||
private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, boolean isRootObject, String idFieldName,
|
||||
String nestedObjectFieldName) throws IOException {
|
||||
|
||||
java.lang.reflect.Field[] fields = clazz.getDeclaredFields();
|
||||
|
||||
if (!isRootObject && isAnyPropertyAnnotatedAsField(fields)) {
|
||||
xContentBuilder.startObject(nestedObjectFieldName)
|
||||
.field("type", "object")
|
||||
.startObject("properties");
|
||||
xContentBuilder.startObject(nestedObjectFieldName).field("type", "object").startObject("properties");
|
||||
}
|
||||
|
||||
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 {
|
||||
xContentBuilder.startObject(field.getName())
|
||||
.field("type", "string")
|
||||
.field("index", "not_analyzed")
|
||||
.endObject();
|
||||
private static void applyDefaultIdFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field)
|
||||
throws IOException {
|
||||
xContentBuilder.startObject(field.getName()).field("type", "string").field("index", "not_analyzed").endObject();
|
||||
}
|
||||
|
||||
private static void applyFieldAnnotationMapping(XContentBuilder xContentBuilder,
|
||||
java.lang.reflect.Field field,
|
||||
private static void applyFieldAnnotationMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field,
|
||||
Field fieldAnnotation) throws IOException {
|
||||
xContentBuilder.startObject(field.getName());
|
||||
xContentBuilder.field("store", fieldAnnotation.store());
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.data.domain.Page;
|
||||
|
||||
/**
|
||||
* ResultsMapper
|
||||
*
|
||||
* @param <T>
|
||||
*
|
||||
* @author Rizwan Idrees
|
||||
|
@ -41,7 +41,8 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
|
||||
@SuppressWarnings("unused")
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public MappingElasticsearchConverter(MappingContext<? extends ElasticsearchPersistentEntity<?>,ElasticsearchPersistentProperty> mappingContext) {
|
||||
public MappingElasticsearchConverter(
|
||||
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
|
||||
Assert.notNull(mappingContext);
|
||||
this.mappingContext = mappingContext;
|
||||
this.conversionService = new DefaultConversionService();
|
||||
|
@ -16,6 +16,7 @@
|
||||
package org.springframework.data.elasticsearch.core.mapping;
|
||||
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
|
||||
/**
|
||||
* ElasticsearchPersistentEntity
|
||||
*
|
||||
@ -26,10 +27,16 @@ import org.springframework.data.mapping.PersistentEntity;
|
||||
public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, ElasticsearchPersistentProperty> {
|
||||
|
||||
String getIndexName();
|
||||
|
||||
String getIndexType();
|
||||
|
||||
short getShards();
|
||||
|
||||
short getReplicas();
|
||||
|
||||
String getRefreshInterval();
|
||||
|
||||
String getIndexStoreType();
|
||||
|
||||
ElasticsearchPersistentProperty getVersionProperty();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch.core.mapping;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
|
||||
/**
|
||||
* ElasticsearchPersistentProperty
|
||||
*
|
||||
|
@ -39,8 +39,8 @@ import static org.springframework.util.StringUtils.hasText;
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
*/
|
||||
public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntity<T, ElasticsearchPersistentProperty> implements
|
||||
ElasticsearchPersistentEntity<T>, ApplicationContextAware {
|
||||
public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntity<T, ElasticsearchPersistentProperty>
|
||||
implements ElasticsearchPersistentEntity<T>, ApplicationContextAware {
|
||||
|
||||
private final StandardEvaluationContext context;
|
||||
private String indexName;
|
||||
@ -56,7 +56,8 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
||||
Class<T> clazz = typeInformation.getType();
|
||||
if (clazz.isAnnotationPresent(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.indexType = hasText(document.type()) ? document.type() : clazz.getSimpleName().toLowerCase(Locale.ENGLISH);
|
||||
this.shards = typeInformation.getType().getAnnotation(Document.class).shards();
|
||||
|
@ -31,8 +31,8 @@ import java.util.Set;
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
*/
|
||||
public class SimpleElasticsearchPersistentProperty extends AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements
|
||||
ElasticsearchPersistentProperty {
|
||||
public class SimpleElasticsearchPersistentProperty extends
|
||||
AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements ElasticsearchPersistentProperty {
|
||||
|
||||
private static final Set<Class<?>> SUPPORTED_ID_TYPES = new HashSet<Class<?>>();
|
||||
private static final Set<String> SUPPORTED_ID_PROPERTY_NAMES = new HashSet<String>();
|
||||
|
@ -255,7 +255,6 @@ public class Criteria {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Crates new CriteriaEntry allowing native elasticsearch expressions
|
||||
*
|
||||
@ -346,7 +345,6 @@ public class Criteria {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private void assertNoBlankInWildcardedQuery(String searchString, boolean leadingWildcard, boolean trailingWildcard) {
|
||||
if (StringUtils.contains(searchString, CRITERIA_VALUE_SEPERATOR)) {
|
||||
throw new InvalidDataAccessApiUsageException("Cannot constructQuery '" + (leadingWildcard ? "*" : "") + "\""
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.query;
|
||||
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@ -28,6 +27,7 @@ import org.springframework.util.Assert;
|
||||
public class CriteriaQuery extends AbstractQuery {
|
||||
|
||||
private Criteria criteria;
|
||||
|
||||
private CriteriaQuery() {
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.query;
|
||||
|
||||
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
||||
/**
|
||||
* DeleteQuery
|
||||
*
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.query;
|
||||
|
||||
|
||||
import org.elasticsearch.index.query.FilterBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilder;
|
||||
@ -43,7 +42,6 @@ public class NativeSearchQuery extends AbstractQuery implements SearchQuery {
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
public FilterBuilder getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.query;
|
||||
|
||||
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Query
|
||||
*
|
||||
@ -32,7 +32,6 @@ public interface Query {
|
||||
public static final int DEFAULT_PAGE_SIZE = 10;
|
||||
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
|
||||
*
|
||||
@ -41,8 +40,6 @@ public interface Query {
|
||||
*/
|
||||
<T extends Query> T setPageable(Pageable pageable);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get filter queries if defined
|
||||
*
|
||||
@ -57,8 +54,6 @@ public interface Query {
|
||||
*/
|
||||
Pageable getPageable();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add {@link org.springframework.data.domain.Sort} to query
|
||||
*
|
||||
@ -72,41 +67,44 @@ public interface Query {
|
||||
*/
|
||||
Sort getSort();
|
||||
|
||||
|
||||
/**
|
||||
* Get Indices to be searched
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> getIndices();
|
||||
|
||||
|
||||
/**
|
||||
* Add Indices to be added as part of search request
|
||||
*
|
||||
* @param indices
|
||||
*/
|
||||
void addIndices(String... indices);
|
||||
|
||||
/**
|
||||
* Add types to be searched
|
||||
*
|
||||
* @param types
|
||||
*/
|
||||
void addTypes(String... types);
|
||||
|
||||
/**
|
||||
* Get types to be searched
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> getTypes();
|
||||
|
||||
/**
|
||||
* Add fields to be added as part of search request
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
void addFields(String... fields);
|
||||
|
||||
|
||||
/**
|
||||
* Get fields to be returned as part of search request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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.QueryBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilder;
|
||||
|
||||
/**
|
||||
* NativeSearchQuery
|
||||
*
|
||||
@ -27,6 +28,8 @@ import org.elasticsearch.search.sort.SortBuilder;
|
||||
*/
|
||||
public interface SearchQuery extends Query {
|
||||
QueryBuilder getQuery();
|
||||
|
||||
FilterBuilder getFilter();
|
||||
|
||||
SortBuilder getElasticsearchSort();
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.query;
|
||||
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
@ -44,7 +43,6 @@ public class StringQuery extends AbstractQuery{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
||||
|
||||
private final Bean<ElasticsearchOperations> elasticsearchOperationsBean;
|
||||
|
||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers, Class<T> repositoryType,
|
||||
BeanManager beanManager) {
|
||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
||||
Class<T> repositoryType, BeanManager beanManager) {
|
||||
super(qualifiers, repositoryType, beanManager);
|
||||
|
||||
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
||||
@ -46,7 +46,8 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,8 @@ public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupp
|
||||
}
|
||||
|
||||
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) {
|
||||
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;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration of the {@link EnableElasticsearchRepositories}
|
||||
* annotation.
|
||||
* {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration
|
||||
* of the {@link EnableElasticsearchRepositories} annotation.
|
||||
*
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -23,11 +23,10 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
|
||||
import org.springframework.data.repository.config.XmlRepositoryConfigurationSource;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} implementation to configure Elasticsearch repository configuration support,
|
||||
* evaluating the {@link EnableElasticsearchRepositories} annotation or the equivalent XML element.
|
||||
* {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} implementation to configure
|
||||
* Elasticsearch repository configuration support, evaluating the {@link EnableElasticsearchRepositories} annotation or
|
||||
* the equivalent XML element.
|
||||
*
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -24,8 +24,8 @@ import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for Spring Data
|
||||
* repositories by default.
|
||||
* Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for
|
||||
* Spring Data repositories by default.
|
||||
*
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -39,7 +39,8 @@ public @interface EnableElasticsearchRepositories {
|
||||
|
||||
/**
|
||||
* 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 {};
|
||||
|
||||
@ -85,7 +86,8 @@ public @interface EnableElasticsearchRepositories {
|
||||
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}.
|
||||
*
|
||||
* @return
|
||||
@ -93,8 +95,8 @@ public @interface EnableElasticsearchRepositories {
|
||||
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
|
||||
* {@link ElasticsearchRepositoryFactoryBean}.
|
||||
* Returns the {@link org.springframework.beans.factory.FactoryBean} class to be used for each repository instance.
|
||||
* Defaults to {@link ElasticsearchRepositoryFactoryBean}.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -103,8 +105,8 @@ public @interface EnableElasticsearchRepositories {
|
||||
// Elasticsearch specific configuration
|
||||
|
||||
/**
|
||||
* Configures the name of the {@link ElasticsearchTemplate} bean definition to be used to create repositories discovered
|
||||
* through this annotation. Defaults to {@code elasticsearchTemplate}.
|
||||
* Configures the name of the {@link ElasticsearchTemplate} bean definition to be used to create repositories
|
||||
* discovered through this annotation. Defaults to {@code elasticsearchTemplate}.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -31,7 +31,8 @@ public abstract class AbstractElasticsearchRepositoryQuery implements Repository
|
||||
protected ElasticsearchQueryMethod queryMethod;
|
||||
protected ElasticsearchOperations elasticsearchOperations;
|
||||
|
||||
public AbstractElasticsearchRepositoryQuery(ElasticsearchQueryMethod queryMethod, ElasticsearchOperations elasticsearchOperations) {
|
||||
public AbstractElasticsearchRepositoryQuery(ElasticsearchQueryMethod queryMethod,
|
||||
ElasticsearchOperations elasticsearchOperations) {
|
||||
this.queryMethod = queryMethod;
|
||||
this.elasticsearchOperations = elasticsearchOperations;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.query;
|
||||
|
||||
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
||||
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
|
||||
@ -35,7 +34,6 @@ public class ElasticsearchPartQuery extends AbstractElasticsearchRepositoryQuery
|
||||
private final PartTree tree;
|
||||
private final MappingContext<?, ElasticsearchPersistentProperty> mappingContext;
|
||||
|
||||
|
||||
public ElasticsearchPartQuery(ElasticsearchQueryMethod method, ElasticsearchOperations elasticsearchOperations) {
|
||||
super(method, elasticsearchOperations);
|
||||
this.tree = new PartTree(method.getName(), method.getEntityInformation().getJavaType());
|
||||
|
@ -36,9 +36,11 @@ public class ElasticsearchQueryMethod extends QueryMethod {
|
||||
private final ElasticsearchEntityInformation<?, ?> entityInformation;
|
||||
private Method method;
|
||||
|
||||
public ElasticsearchQueryMethod(Method method, RepositoryMetadata metadata, ElasticsearchEntityInformationCreator elasticsearchEntityInformationCreator) {
|
||||
public ElasticsearchQueryMethod(Method method, RepositoryMetadata metadata,
|
||||
ElasticsearchEntityInformationCreator elasticsearchEntityInformationCreator) {
|
||||
super(method, metadata);
|
||||
this.entityInformation = elasticsearchEntityInformationCreator.getEntityInformation(metadata.getReturnedDomainClass(method));
|
||||
this.entityInformation = elasticsearchEntityInformationCreator.getEntityInformation(metadata
|
||||
.getReturnedDomainClass(method));
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.query;
|
||||
|
||||
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
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);
|
||||
Assert.notNull(query, "Query cannot be empty");
|
||||
this.query = query;
|
||||
@ -75,7 +75,6 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
|
||||
return elasticsearchOperations.queryForObject(stringQuery, queryMethod.getEntityInformation().getJavaType());
|
||||
}
|
||||
|
||||
|
||||
protected StringQuery createQuery(ParametersParameterAccessor parameterAccessor) {
|
||||
String queryString = replacePlaceholders(this.query, parameterAccessor);
|
||||
return new StringQuery(queryString);
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.query.parser;
|
||||
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
|
||||
@ -41,7 +40,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
|
||||
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);
|
||||
this.context = context;
|
||||
}
|
||||
@ -53,7 +53,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
|
||||
@Override
|
||||
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(),
|
||||
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
||||
}
|
||||
@ -63,7 +64,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
if (base == null) {
|
||||
return create(part, iterator);
|
||||
}
|
||||
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
|
||||
PersistentPropertyPath<ElasticsearchPersistentProperty> path = context
|
||||
.getPersistentPropertyPath(part.getProperty());
|
||||
return base.addCriteria(from(part.getType(),
|
||||
new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
|
||||
}
|
||||
@ -81,7 +83,6 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
return query.addSort(sort);
|
||||
}
|
||||
|
||||
|
||||
private Criteria from(Part.Type type, Criteria instance, Iterator<?> parameters) {
|
||||
Criteria criteria = instance;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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 Mohsin Husen
|
||||
* @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 Class<T> entityClass;
|
||||
@ -58,7 +59,8 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
this.setElasticsearchOperations(elasticsearchOperations);
|
||||
}
|
||||
|
||||
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata, ElasticsearchOperations elasticsearchOperations) {
|
||||
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata,
|
||||
ElasticsearchOperations elasticsearchOperations) {
|
||||
this(elasticsearchOperations);
|
||||
Assert.notNull(metadata);
|
||||
this.entityInformation = metadata;
|
||||
@ -93,10 +95,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
|
||||
@Override
|
||||
public Page<T> findAll(Pageable pageable) {
|
||||
SearchQuery query = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withPageable(pageable)
|
||||
.build();
|
||||
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withPageable(pageable).build();
|
||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||
}
|
||||
|
||||
@ -106,25 +105,21 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
if (itemCount == 0) {
|
||||
return new PageImpl<T>(Collections.<T> emptyList());
|
||||
}
|
||||
SearchQuery query = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withPageable(new PageRequest(0,itemCount, sort))
|
||||
.build();
|
||||
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||
.withPageable(new PageRequest(0, itemCount, sort)).build();
|
||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> findAll(Iterable<ID> ids) {
|
||||
SearchQuery query = new NativeSearchQueryBuilder()
|
||||
.withQuery(inQuery(entityInformation.getIdAttribute(), ids))
|
||||
SearchQuery query = new NativeSearchQueryBuilder().withQuery(inQuery(entityInformation.getIdAttribute(), ids))
|
||||
.build();
|
||||
return elasticsearchOperations.queryForPage(query, getEntityClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
SearchQuery query = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery()).build();
|
||||
SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||
return elasticsearchOperations.count(query, getEntityClass());
|
||||
}
|
||||
|
||||
@ -175,8 +170,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
|
||||
@Override
|
||||
public Iterable<T> search(QueryBuilder query) {
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(query).build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(query).build();
|
||||
int count = (int) elasticsearchOperations.count(searchQuery, getEntityClass());
|
||||
if (count == 0) {
|
||||
return new PageImpl<T>(Collections.<T> emptyList());
|
||||
@ -187,10 +181,7 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
|
||||
@Override
|
||||
public Page<T> search(QueryBuilder query, Pageable pageable) {
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(query)
|
||||
.withPageable(pageable)
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(query).withPageable(pageable).build();
|
||||
return elasticsearchOperations.queryForPage(searchQuery, getEntityClass());
|
||||
}
|
||||
|
||||
@ -216,11 +207,11 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
return elasticsearchOperations.moreLikeThis(query, getEntityClass());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(ID id) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -298,7 +289,6 @@ public abstract class AbstractElasticsearchRepository<T,ID extends Serializable>
|
||||
this.elasticsearchOperations = elasticsearchOperations;
|
||||
}
|
||||
|
||||
|
||||
protected ID extractIdFromBean(T entity) {
|
||||
if (entityInformation != null) {
|
||||
return entityInformation.getId(entity);
|
||||
|
@ -29,7 +29,10 @@ import java.io.Serializable;
|
||||
public interface ElasticsearchEntityInformation<T, ID extends Serializable> extends EntityInformation<T, ID> {
|
||||
|
||||
String getIdAttribute();
|
||||
|
||||
String getIndexName();
|
||||
|
||||
String getType();
|
||||
|
||||
Long getVersion(T entity);
|
||||
}
|
||||
|
@ -42,15 +42,14 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
||||
|
||||
|
||||
private final ElasticsearchOperations elasticsearchOperations;
|
||||
private final ElasticsearchEntityInformationCreator entityInformationCreator;
|
||||
|
||||
public ElasticsearchRepositoryFactory(ElasticsearchOperations elasticsearchOperations) {
|
||||
Assert.notNull(elasticsearchOperations);
|
||||
this.elasticsearchOperations = elasticsearchOperations;
|
||||
this.entityInformationCreator = new ElasticsearchEntityInformationCreatorImpl(elasticsearchOperations.getElasticsearchConverter()
|
||||
.getMappingContext());
|
||||
this.entityInformationCreator = new ElasticsearchEntityInformationCreatorImpl(elasticsearchOperations
|
||||
.getElasticsearchConverter().getMappingContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,17 +66,16 @@ public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
||||
AbstractElasticsearchRepository repository;
|
||||
|
||||
// Probably a better way to store and look these up.
|
||||
if(Integer.class.isAssignableFrom(entityInformation.getIdType()) ||
|
||||
Long.class.isAssignableFrom(entityInformation.getIdType()) ||
|
||||
Double.class.isAssignableFrom(entityInformation.getIdType())){
|
||||
if (Integer.class.isAssignableFrom(entityInformation.getIdType())
|
||||
|| Long.class.isAssignableFrom(entityInformation.getIdType())
|
||||
|| Double.class.isAssignableFrom(entityInformation.getIdType())) {
|
||||
// logger.debug("Using NumberKeyedRepository for " + metadata.getRepositoryInterface());
|
||||
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());
|
||||
repository = new SimpleElasticsearchRepository(getEntityInformation(metadata.getDomainType()), elasticsearchOperations);
|
||||
}
|
||||
else {
|
||||
repository = new SimpleElasticsearchRepository(getEntityInformation(metadata.getDomainType()),
|
||||
elasticsearchOperations);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsuppored ID type " + entityInformation.getIdType());
|
||||
}
|
||||
repository.setEntityClass(metadata.getDomainType());
|
||||
@ -113,8 +111,7 @@ public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
|
||||
if (namedQueries.hasQuery(namedQueryName)) {
|
||||
String namedQuery = namedQueries.getQuery(namedQueryName);
|
||||
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, namedQuery);
|
||||
}
|
||||
else if (queryMethod.hasAnnotatedQuery()) {
|
||||
} else if (queryMethod.hasAnnotatedQuery()) {
|
||||
return new ElasticsearchStringQuery(queryMethod, elasticsearchOperations, queryMethod.getAnnotatedQuery());
|
||||
}
|
||||
return new ElasticsearchPartQuery(queryMethod, elasticsearchOperations);
|
||||
|
@ -24,7 +24,8 @@ import org.springframework.util.Assert;
|
||||
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 Mohsin Husen
|
||||
@ -54,7 +55,6 @@ public class ElasticsearchRepositoryFactoryBean<T extends Repository<S, ID>, S,
|
||||
Assert.notNull(operations, "ElasticsearchOperations must be configured!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected RepositoryFactorySupport createRepositoryFactory() {
|
||||
return new ElasticsearchRepositoryFactory(operations);
|
||||
|
@ -26,7 +26,8 @@ import org.springframework.data.repository.core.support.AbstractEntityInformatio
|
||||
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 <ID>
|
||||
@ -75,7 +76,9 @@ public class MappingElasticsearchEntityInformation<T, ID extends Serializable> e
|
||||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
|
||||
@ -102,5 +105,3 @@ public class MappingElasticsearchEntityInformation<T, ID extends Serializable> e
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,8 @@ package org.springframework.data.elasticsearch.repository.support;
|
||||
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
|
||||
@ -27,12 +28,12 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
*/
|
||||
public class NumberKeyedRepository<T, ID extends Number> extends AbstractElasticsearchRepository<T, ID> {
|
||||
|
||||
|
||||
public NumberKeyedRepository() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NumberKeyedRepository(ElasticsearchEntityInformation<T, ID> metadata,ElasticsearchOperations elasticsearchOperations) {
|
||||
public NumberKeyedRepository(ElasticsearchEntityInformation<T, ID> metadata,
|
||||
ElasticsearchOperations elasticsearchOperations) {
|
||||
super(metadata, elasticsearchOperations);
|
||||
}
|
||||
|
||||
@ -40,12 +41,9 @@ public class NumberKeyedRepository<T,ID extends Number> extends AbstractElastics
|
||||
super(elasticsearchOperations);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String stringIdRepresentation(ID id) {
|
||||
return String.valueOf(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ package org.springframework.data.elasticsearch.repository.support;
|
||||
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
|
||||
@ -31,7 +32,8 @@ public class SimpleElasticsearchRepository<T> extends AbstractElasticsearchRepos
|
||||
super();
|
||||
}
|
||||
|
||||
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T, String> metadata,ElasticsearchOperations elasticsearchOperations) {
|
||||
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T, String> metadata,
|
||||
ElasticsearchOperations elasticsearchOperations) {
|
||||
super(metadata, elasticsearchOperations);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.elasticsearch.annotations.Document;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -66,6 +66,4 @@ public class DoubleIDEntity {
|
||||
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")
|
||||
public class IntegerIDEntity {
|
||||
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
private String type;
|
||||
@ -67,6 +66,4 @@ public class IntegerIDEntity {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.data.elasticsearch.repositories.SampleElasticSearchBookRepository;
|
||||
@ -24,11 +23,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -40,7 +39,6 @@ public class NestedObjectTests{
|
||||
@Resource
|
||||
private SampleElasticSearchBookRepository repository;
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldIndexNestedObject() {
|
||||
// given
|
||||
@ -58,4 +56,3 @@ public class NestedObjectTests{
|
||||
assertThat(repository.findOne(id), is(notNullValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -15,23 +15,21 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.data.elasticsearch.repositories.NonDocumentEntityRepository;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
*/
|
||||
public class NonDocumentEntityTests {
|
||||
|
||||
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void shouldNotInitialiseRepositoryWithNonDocument() {
|
||||
// when
|
||||
ClassPathXmlApplicationContext ctx =
|
||||
new ClassPathXmlApplicationContext("/repository-non-document-entity.xml");
|
||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/repository-non-document-entity.xml");
|
||||
ctx.getBean(NonDocumentEntityRepository.class);
|
||||
}
|
||||
}
|
||||
|
@ -94,24 +94,13 @@ public class SampleEntity {
|
||||
return true;
|
||||
}
|
||||
SampleEntity rhs = (SampleEntity) obj;
|
||||
return new EqualsBuilder().append(this.id, rhs.id)
|
||||
.append(this.type, rhs.type)
|
||||
.append(this.message, rhs.message)
|
||||
.append(this.rate,rhs.rate)
|
||||
.append(this.available,rhs.available)
|
||||
.append(this.version,rhs.version)
|
||||
.isEquals();
|
||||
return new EqualsBuilder().append(this.id, rhs.id).append(this.type, rhs.type).append(this.message, rhs.message)
|
||||
.append(this.rate, rhs.rate).append(this.available, rhs.available).append(this.version, rhs.version).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(type)
|
||||
.append(message)
|
||||
.append(rate)
|
||||
.append(available)
|
||||
.append(version)
|
||||
return new HashCodeBuilder().append(id).append(type).append(message).append(rate).append(available).append(version)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch;
|
||||
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.elasticsearch.annotations.Document;
|
||||
import org.springframework.data.elasticsearch.annotations.Field;
|
||||
@ -50,7 +49,6 @@ public class SampleMappingEntity {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
static class NestedEntity {
|
||||
@Field(type = "string")
|
||||
private String someField;
|
||||
@ -65,6 +63,3 @@ public class SampleMappingEntity {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -57,7 +57,8 @@ public class ElasticsearchNamespaceHandlerTests {
|
||||
@Test
|
||||
public void shouldCreateRepository() {
|
||||
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;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core;
|
||||
|
||||
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
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.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -254,10 +254,8 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.index(indexQuery);
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withFilter(boolFilter().must(termFilter("id", documentId)))
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||
.withFilter(boolFilter().must(termFilter("id", documentId))).build();
|
||||
// when
|
||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
||||
// then
|
||||
@ -311,10 +309,8 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withSort(new FieldSortBuilder("rate").ignoreUnmapped(true).order(SortOrder.ASC))
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
|
||||
.withSort(new FieldSortBuilder("rate").ignoreUnmapped(true).order(SortOrder.ASC)).build();
|
||||
// when
|
||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class);
|
||||
// then
|
||||
@ -387,7 +383,8 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.index(indexQuery);
|
||||
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
|
||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(stringQuery, SampleEntity.class);
|
||||
// then
|
||||
@ -426,7 +423,6 @@ public class ElasticsearchTemplateTests {
|
||||
assertThat(created, is(true));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldExecuteGivenCriteriaQuery() {
|
||||
// given
|
||||
@ -466,12 +462,8 @@ public class ElasticsearchTemplateTests {
|
||||
|
||||
elasticsearchTemplate.index(indexQuery);
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withIndices("test-index")
|
||||
.withTypes("test-type")
|
||||
.withFields("message")
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withIndices("test-index")
|
||||
.withTypes("test-type").withFields("message").build();
|
||||
// when
|
||||
Page<String> page = elasticsearchTemplate.queryForPage(searchQuery, new ResultsMapper<String>() {
|
||||
@Override
|
||||
@ -492,11 +484,11 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldReturnSimilarResultsGivenMoreLikeThisQuery() {
|
||||
// given
|
||||
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," +
|
||||
" 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 real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
||||
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,"
|
||||
+ " 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 real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
||||
|
||||
String documentId1 = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@ -523,7 +515,6 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.index(indexQuery2);
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
|
||||
|
||||
MoreLikeThisQuery moreLikeThisQuery = new MoreLikeThisQuery();
|
||||
moreLikeThisQuery.setId(documentId2);
|
||||
moreLikeThisQuery.addFields("message");
|
||||
@ -569,12 +560,8 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
// then
|
||||
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.withIndices("test-index")
|
||||
.withTypes("test-type")
|
||||
.withPageable(new PageRequest(0,1))
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withIndices("test-index")
|
||||
.withTypes("test-type").withPageable(new PageRequest(0, 1)).build();
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
@ -600,8 +587,7 @@ public class ElasticsearchTemplateTests {
|
||||
if (page != null) {
|
||||
sampleEntities.addAll(page.getContent());
|
||||
hasRecords = page.hasNextPage();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
hasRecords = false;
|
||||
}
|
||||
|
||||
@ -655,9 +641,12 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.refresh(SampleEntity.class, true);
|
||||
// when
|
||||
CriteriaQuery singleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("test"));
|
||||
CriteriaQuery multipleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").and("message").contains("message"));
|
||||
List<SampleEntity> sampleEntitiesForSingleCriteria = elasticsearchTemplate.queryForList(singleCriteriaQuery,SampleEntity.class);
|
||||
List<SampleEntity> sampleEntitiesForAndCriteria = elasticsearchTemplate.queryForList(multipleCriteriaQuery,SampleEntity.class);
|
||||
CriteriaQuery multipleCriteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").and("message")
|
||||
.contains("message"));
|
||||
List<SampleEntity> sampleEntitiesForSingleCriteria = elasticsearchTemplate.queryForList(singleCriteriaQuery,
|
||||
SampleEntity.class);
|
||||
List<SampleEntity> sampleEntitiesForAndCriteria = elasticsearchTemplate.queryForList(multipleCriteriaQuery,
|
||||
SampleEntity.class);
|
||||
// then
|
||||
assertThat(sampleEntitiesForSingleCriteria.size(), is(2));
|
||||
assertThat(sampleEntitiesForAndCriteria.size(), is(1));
|
||||
@ -733,6 +722,4 @@ public class ElasticsearchTemplateTests {
|
||||
assertThat(elasticsearchTemplate.indexExists(clazz), is(false));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class DateTimeConvertersTests {
|
||||
@Test
|
||||
public void testJodaDateTimeConverter() {
|
||||
DateTime dateTime = new DateTime(2013, 1, 24, 6, 35, 0, DateTimeZone.UTC);
|
||||
Assert.assertEquals("2013-01-24T06:35:00.000Z",
|
||||
DateTimeConverters.JodaDateTimeConverter.INSTANCE.convert(dateTime));
|
||||
Assert
|
||||
.assertEquals("2013-01-24T06:35:00.000Z", DateTimeConverters.JodaDateTimeConverter.INSTANCE.convert(dateTime));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.convert;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
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.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -24,6 +24,7 @@ import org.springframework.data.util.TypeInformation;
|
||||
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -34,40 +35,39 @@ public class SimpleElasticsearchPersistentEntityTests {
|
||||
public void shouldThrowExceptionGivenVersionPropertyIsNotLong() throws NoSuchFieldException, IntrospectionException {
|
||||
// given
|
||||
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithWrongVersionType.class);
|
||||
SimpleElasticsearchPersistentProperty persistentProperty =
|
||||
new SimpleElasticsearchPersistentProperty(EntityWithWrongVersionType.class.getDeclaredField("version"),
|
||||
new PropertyDescriptor("version", EntityWithWrongVersionType.class),
|
||||
new SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType>(typeInformation),
|
||||
new SimpleTypeHolder());
|
||||
SimpleElasticsearchPersistentProperty persistentProperty = new SimpleElasticsearchPersistentProperty(
|
||||
EntityWithWrongVersionType.class.getDeclaredField("version"), new PropertyDescriptor("version",
|
||||
EntityWithWrongVersionType.class), new SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType>(
|
||||
typeInformation), new SimpleTypeHolder());
|
||||
|
||||
// when
|
||||
new SimpleElasticsearchPersistentEntity(typeInformation).addPersistentProperty(persistentProperty);
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = MappingException.class)
|
||||
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() throws NoSuchFieldException, IntrospectionException {
|
||||
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() throws NoSuchFieldException,
|
||||
IntrospectionException {
|
||||
// given
|
||||
TypeInformation typeInformation = ClassTypeInformation.from(EntityWithMultipleVersionField.class);
|
||||
SimpleElasticsearchPersistentProperty persistentProperty1 =
|
||||
new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version1"),
|
||||
new PropertyDescriptor("version1", EntityWithMultipleVersionField.class),
|
||||
SimpleElasticsearchPersistentProperty persistentProperty1 = new SimpleElasticsearchPersistentProperty(
|
||||
EntityWithMultipleVersionField.class.getDeclaredField("version1"), new PropertyDescriptor("version1",
|
||||
EntityWithMultipleVersionField.class),
|
||||
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
||||
new SimpleTypeHolder());
|
||||
|
||||
SimpleElasticsearchPersistentProperty persistentProperty2 =
|
||||
new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version2"),
|
||||
new PropertyDescriptor("version2", EntityWithMultipleVersionField.class),
|
||||
SimpleElasticsearchPersistentProperty persistentProperty2 = new SimpleElasticsearchPersistentProperty(
|
||||
EntityWithMultipleVersionField.class.getDeclaredField("version2"), new PropertyDescriptor("version2",
|
||||
EntityWithMultipleVersionField.class),
|
||||
new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
|
||||
new SimpleTypeHolder());
|
||||
|
||||
SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity(typeInformation);
|
||||
SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity(
|
||||
typeInformation);
|
||||
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty1);
|
||||
// when
|
||||
simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty2);
|
||||
}
|
||||
|
||||
|
||||
private class EntityWithWrongVersionType {
|
||||
@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.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -66,7 +67,8 @@ public class CriteriaQueryTests {
|
||||
indexQuery.setObject(sampleEntity);
|
||||
elasticsearchTemplate.index(indexQuery);
|
||||
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
|
||||
SampleEntity sampleEntity1 = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
||||
// then
|
||||
@ -103,7 +105,8 @@ public class CriteriaQueryTests {
|
||||
indexQueries.add(indexQuery2);
|
||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||
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
|
||||
Page<SampleEntity> page = elasticsearchTemplate.queryForPage(criteriaQuery, SampleEntity.class);
|
||||
// then
|
||||
@ -137,7 +140,6 @@ public class CriteriaQueryTests {
|
||||
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldPerformOrOperationWithinCriteria() {
|
||||
// given
|
||||
@ -413,7 +415,8 @@ public class CriteriaQueryTests {
|
||||
|
||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||
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
|
||||
SampleEntity sampleEntity = elasticsearchTemplate.queryForObject(criteriaQuery, SampleEntity.class);
|
||||
// then
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repositories;
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
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.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -109,7 +109,6 @@ public class CustomMethodRepositoryTests {
|
||||
assertThat(page.getTotalElements(), is(greaterThanOrEqualTo(1L)));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldExecuteCustomMethodWithLessThan() {
|
||||
// given
|
||||
@ -425,7 +424,8 @@ public class CustomMethodRepositoryTests {
|
||||
repository.save(sampleEntity);
|
||||
}
|
||||
// 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
|
||||
assertThat(pageResult.getTotalElements(), is(equalTo(30L)));
|
||||
assertThat(pageResult.getContent().size(), is(equalTo(23)));
|
||||
@ -455,13 +455,13 @@ public class CustomMethodRepositoryTests {
|
||||
sampleEntity.setVersion(System.currentTimeMillis());
|
||||
repository.save(sampleEntity3);
|
||||
// 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
|
||||
assertThat(pageResult.getContent().isEmpty(), is(false));
|
||||
assertThat(pageResult.getContent().get(0).getMessage(), is(sampleEntity3.getMessage()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldReturnListForMessage() {
|
||||
// given
|
||||
@ -492,8 +492,4 @@ public class CustomMethodRepositoryTests {
|
||||
assertThat(sampleEntities.size(), is(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,4 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchRepository
|
||||
|
||||
public interface DoubleIDRepository extends ElasticsearchRepository<DoubleIDEntity, Double> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repositories;
|
||||
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch.repositories;
|
||||
|
||||
import org.springframework.data.elasticsearch.SampleEntity;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.support;
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
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 static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
@ -53,8 +53,6 @@ public class ElasticsearchRepositoryFactoryTests {
|
||||
factory = new ElasticsearchRepositoryFactory(operations);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldThrowExceptionGivenQueryDslRepository() {
|
||||
// given
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.support;
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@ -52,7 +51,6 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
@Resource
|
||||
private SampleElasticsearchRepository repository;
|
||||
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
repository.deleteAll();
|
||||
@ -163,9 +161,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
sampleEntity.setVersion(System.currentTimeMillis());
|
||||
repository.save(sampleEntity);
|
||||
|
||||
SearchQuery query = new NativeSearchQueryBuilder()
|
||||
.withQuery(termQuery("message", "test"))
|
||||
.build();
|
||||
SearchQuery query = new NativeSearchQueryBuilder().withQuery(termQuery("message", "test")).build();
|
||||
// when
|
||||
Page<SampleEntity> page = repository.search(query);
|
||||
// then
|
||||
@ -265,9 +261,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
sampleEntity.setVersion(System.currentTimeMillis());
|
||||
repository.save(sampleEntity);
|
||||
// when
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(fieldQuery("id",documentId))
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(fieldQuery("id", documentId)).build();
|
||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||
// then
|
||||
assertThat(sampleEntities.getTotalElements(), equalTo(1L));
|
||||
@ -278,9 +272,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
// when
|
||||
repository.deleteAll();
|
||||
// then
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(matchAllQuery())
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
||||
}
|
||||
@ -297,9 +289,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
// when
|
||||
repository.delete(sampleEntity);
|
||||
// then
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withQuery(fieldQuery("id", documentId))
|
||||
.build();
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(fieldQuery("id", documentId)).build();
|
||||
Page<SampleEntity> sampleEntities = repository.search(searchQuery);
|
||||
assertThat(sampleEntities.getTotalElements(), equalTo(0L));
|
||||
}
|
||||
@ -390,21 +380,17 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
@Test
|
||||
public void shouldReturnSimilarEntities() {
|
||||
// given
|
||||
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," +
|
||||
" 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 real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud.";
|
||||
|
||||
|
||||
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,"
|
||||
+ " 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 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);
|
||||
repository.save(sampleEntities);
|
||||
|
||||
// when
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
.withPageable(new PageRequest(0, 5))
|
||||
.withFields("message")
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder().withPageable(new PageRequest(0, 5)).withFields("message")
|
||||
.build();
|
||||
Page<SampleEntity> results = repository.searchSimilar(sampleEntities.get(0), searchQuery);
|
||||
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
<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" />
|
||||
</bean>
|
||||
|
||||
|
||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories" />
|
||||
<elasticsearch:repositories
|
||||
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||
|
||||
|
||||
</beans>
|
@ -7,7 +7,8 @@
|
||||
|
||||
<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" />
|
||||
</bean>
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
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">
|
||||
|
||||
<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>
|
@ -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
|
||||
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" />
|
||||
</bean>
|
||||
|
||||
<elasticsearch:transport-client id="transportClient" />
|
||||
|
||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories"/>
|
||||
<elasticsearch:repositories
|
||||
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||
|
||||
|
||||
</beans>
|
@ -7,7 +7,8 @@
|
||||
|
||||
<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" />
|
||||
</bean>
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
<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" />
|
||||
</bean>
|
||||
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
<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" />
|
||||
</bean>
|
||||
|
||||
|
||||
<elasticsearch:repositories base-package="org.springframework.data.elasticsearch.repositories"/>
|
||||
<elasticsearch:repositories
|
||||
base-package="org.springframework.data.elasticsearch.repositories" />
|
||||
|
||||
|
||||
</beans>
|
Loading…
x
Reference in New Issue
Block a user