Package org.springframework.data.solr.core.schema.SchemaDefinition

Examples of org.springframework.data.solr.core.schema.SchemaDefinition.FieldDefinition


    entity.doWithProperties(new PropertyHandler<SolrPersistentProperty>() {

      @Override
      public void doWithPersistentProperty(SolrPersistentProperty persistentProperty) {

        FieldDefinition fieldDefinition = createFieldDefinitionForProperty(persistentProperty);
        if (fieldDefinition != null) {
          schemaDefinition.addFieldDefinition(fieldDefinition);
        }
      }
    });
View Full Code Here


    if (property == null || property.isReadonly() || property.isTransient()) {
      return null;
    }

    FieldDefinition definition = new FieldDefinition(property.getFieldName());
    definition.setMultiValued(property.isMultiValued());
    definition.setIndexed(property.isSearchable());
    definition.setStored(property.isStored());
    definition.setType(property.getSolrTypeName());
    definition.setDefaultValue(property.getDefaultValue());
    definition.setRequired(property.isRequired());

    Collection<String> copyFields = property.getCopyFields();
    if (!CollectionUtils.isEmpty(copyFields)) {
      definition.setCopyFields(copyFields);
    }

    return definition;
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void requiredPropertyShouldBeMappedCorrectly() {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor("requiredProperty",
        Foo.class));
    assertThat(fieldDef, hasProperty("required", equalTo(true)));
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void searchablePropertyShouldBeMappedCorrectly() {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor("nonSearchableProperty",
        Foo.class));
    assertThat(fieldDef, hasProperty("indexed", equalTo(false)));
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void storedPropertyShouldBeMappedCorrectly() {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor("nonStoredProperty",
        Foo.class));
    assertThat(fieldDef, hasProperty("stored", equalTo(false)));
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void copyToPropertyShouldBeMappedCorrectly() {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor(
        "propertyCopiedTo2Fields", Foo.class));
    assertThat(fieldDef, hasProperty("copyFields", equalTo(Arrays.asList("foo", "bar"))));
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void collectionPropertyShouldBeMappedAsMultivalued() {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor("collectionProperty",
        Foo.class));
    assertThat(fieldDef, hasProperty("multiValued", equalTo(true)));
  }
View Full Code Here

   * @see DATASOLR-72
   */
  @Test
  public void collectionPropertyTypeShouldBeResolvedCorrectly() throws JsonProcessingException {

    FieldDefinition fieldDef = schemaResolver.createFieldDefinitionForProperty(getPropertyFor("collectionProperty",
        Foo.class));
    assertThat(fieldDef, hasProperty("type", equalTo("string")));

    ObjectMapper mapper = new ObjectMapper();
    System.out.println(mapper.writeValueAsString(fieldDef));
View Full Code Here

   */
  @Test
  public void loadExistingSchemaShouldMapFieldInformationCorrectly() {

    setUpJsonResponse(JSON_RESPONSE_DEFAULT_SCHEMA);
    FieldDefinition fieldDef = writer.loadExistingSchema("collection1").getFieldDefinition("id");

    Assert.assertEquals("id", fieldDef.getName());
    Assert.assertEquals("string", fieldDef.getType());
    Assert.assertEquals(false, fieldDef.isMultiValued());
    Assert.assertEquals(true, fieldDef.isIndexed());
    Assert.assertEquals(true, fieldDef.isRequired());
    Assert.assertEquals(true, fieldDef.isStored());
  }
View Full Code Here

   */
  @Test
  public void writeSchemaDefintion() {

    SchemaDefinition def = new SchemaDefinition("collection1");
    FieldDefinition df = new FieldDefinition();
    df.setName("hululu");
    df.setType("string");
    df.setStored(true);
    df.setIndexed(false);

    def.setFields(Collections.singletonList(df));

    schemaWriter.writeSchema(def);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.schema.SchemaDefinition.FieldDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.