public FieldMapping index(Index index) { return fieldMapping.index( index ); }
public FieldMapping name(String fieldName) { return fieldMapping.name( fieldName ); }
public FieldMapping store(Store store) { return fieldMapping.store( store ); }
.property( "addressId", ElementType.FIELD ).documentId().name( "id" ) .property( "lastUpdated", ElementType.FIELD ) .field().name( "last-updated" ) .analyzer( EN_ANALYZER_NAME ).store( Store.YES ) .calendarBridge( Resolution.DAY ) .property( "dateCreated", ElementType.FIELD ) .field().name( "date-created" ).index( Index.YES ) .store( Store.YES ) .dateBridge( Resolution.DAY ) .property( "owner", ElementType.FIELD ) .field() .property( "street1", ElementType.FIELD ) .field() .field().name( "street1_ngram" ).analyzer( NGRAM_ANALYZER_NAME ) .field() .name( "street1_abridged" ) .bridge( ConcatStringBridge.class ).param( ConcatStringBridge.SIZE, "4" ) .field().name( "street1_normalized" ).normalizer( LOWERCASE_NORMALIZER_NAME ) .property( "street2", ElementType.METHOD ) .field().name( "idx_street2" ).store( Store.YES ).boost( 2 ) .entity( ProvidedIdEntry.class ).indexed() .providedId().name( "providedidentry.providedid" ).bridge( LongBridge.class ) .property( "name", ElementType.FIELD ) .field().name( "providedidentry.name" ).analyzer( EN_ANALYZER_NAME ).index( Index.YES ).store( Store.YES ) .property( "blurb", ElementType.FIELD ) .field().name( "providedidentry.blurb" ).analyzer( EN_ANALYZER_NAME ).index( Index.YES ).store( Store.YES ) .property( "age", ElementType.FIELD ) .field().name( "providedidentry.age" ).analyzer( EN_ANALYZER_NAME ).index( Index.YES ).store( Store.YES ) .entity( ProductCatalog.class ).indexed()
.entity(InternalProcessDefinition.class).indexed().indexName("process_definition") .property("dbid", ElementType.FIELD).documentId().name(ProcessDefinitionIndex.DBID) .entity(LightProcessDefinitionImpl.class) .property("uuid", ElementType.FIELD).field().name(ProcessDefinitionIndex.UUID) .bridge(UUIDFieldBridge.class) .property("categoryNames", ElementType.METHOD).field().name(ProcessDefinitionIndex.CATEGORY_NAME) .bridge(StringSetFieldBridge.class) .entity(NamedElementImpl.class) .property("name", ElementType.METHOD).field().name(ProcessDefinitionIndex.NAME) .entity(DescriptionElementImpl.class) // share with All DescriptionElement: processes, groups, ... .property("description", ElementType.METHOD).field().name(ProcessDefinitionIndex.DESCRIPTION) .property("dbid", ElementType.FIELD).documentId().name(ProcessInstanceIndex.DBID) .entity(ProcessInstanceImpl.class) .property("commentFeed", ElementType.METHOD).indexEmbedded() .property("involvedUsers", ElementType.METHOD).field().name(ProcessInstanceIndex.INVOLVED_USER) .bridge(StringSetFieldBridge.class) .property("activities", ElementType.METHOD).indexEmbedded() .property("lastKnownVariableValues", ElementType.METHOD).field().name("variable") .bridge(ObjectMapFieldBridge.class) .property("activeUsers", ElementType.METHOD).field().name(ProcessInstanceIndex.ACTIVE_USER) .bridge(StringSetFieldBridge.class) .entity(LightProcessInstanceImpl.class) .property("nb", ElementType.FIELD).field().name(ProcessInstanceIndex.NB) .property("startedBy", ElementType.METHOD).field().name(ProcessInstanceIndex.STARTED_BY) .property("endedBy", ElementType.METHOD).field().name(ProcessInstanceIndex.ENDED_BY) .property("startedDate", ElementType.METHOD).field().name(ProcessInstanceIndex.STARTED_DATE) .index(Index.UN_TOKENIZED).dateBridge(Resolution.MILLISECOND) .property("endedDate", ElementType.METHOD).field().name(ProcessInstanceIndex.ENDED_DATE)
static SearchMapping buildMappingDefinition() { SearchMapping mapping = new SearchMapping(); mapping .entity( TelephoneRecord.class ) .indexed() .indexName( "phoneNumbersIndex" ) .property( "id", ElementType.FIELD ).documentId() .property( "phone", ElementType.FIELD ).field().analyze( Analyze.NO ).store( Store.YES ) .entity( AddressBook.class ) .indexed() .indexName( "addressBookIndex" ) .property( "id", ElementType.FIELD ).documentId() .property( "name", ElementType.FIELD ).field().store( Store.YES ) ; return mapping; }
public FieldMapping field() { return new FieldMapping( property, entity, mapping ); } }
private SearchMapping createSearchMapping() { SearchMapping mapping = new SearchMapping(); mapping.entity( ProgrammaticConfiguredValue.class ) .indexed() .property( "id", ElementType.FIELD ).documentId().name( "id" ) .property( "value", ElementType.FIELD ).field().store( Store.YES ).indexNullAs( "@null@" ); return mapping; }
public FieldMapping analyzer(Class<?> analyzerClass) { return fieldMapping.analyzer( analyzerClass ); }
public FieldMapping boost(float boost) { return fieldMapping.boost( boost ); }
public AnalyzerDefMapping analyzerDef(String name, Class<? extends TokenizerFactory> tokenizerFactory) { return analyzerDef( name, "", tokenizerFactory ); }
public FieldMapping field() { return new FieldMapping( property, entity, mapping ); }
@Test public void usingConfigurationTypeOverride() { SearchMapping mapping = new SearchMapping(); mapping .entity( Book.class ).indexed() //Entity missing both @DocumentId and @ProvidedId: .property( "title", ElementType.FIELD ).field() .property( "text", ElementType.FIELD ).field() ; SearchConfigurationForTest cfg = new SearchConfigurationForTest() .setProgrammaticMapping( mapping ) .setIdProvidedImplicit( true ) .addClass( Book.class ); storeBooksViaProvidedId( cfg, ProvidedId.defaultFieldName, false ); }
public FieldMapping analyzer(String analyzerDef) { return fieldMapping.analyzer( analyzerDef ); }
public FieldMapping boost(float boost) { return fieldMapping.boost( boost ); }
public AnalyzerDefMapping analyzerDef(String name, Class<? extends TokenizerFactory> tokenizerFactory) { return analyzerDef( name, "", tokenizerFactory ); }
public FieldMapping field() { return new FieldMapping( property, entity, mapping ); }
@Test public void usingDefaultSettings() { SearchMapping mapping = new SearchMapping(); mapping .entity( Book.class ).indexed() .providedId().name( "myID" ) //Entity missing both @DocumentId and @ProvidedId: .property( "title", ElementType.FIELD ).field() .property( "text", ElementType.FIELD ).field() ; SearchConfigurationForTest cfg = new SearchConfigurationForTest() .setProgrammaticMapping( mapping ) //.setIdProvidedImplicit( false ) //Test it's the default .addClass( Book.class ); storeBooksViaProvidedId( cfg, "myID", false ); }
public FieldMapping analyzer(String analyzerDef) { return fieldMapping.analyzer( analyzerDef ); }