Skip to content

Commit

Permalink
HSEARCH-4217 Rename LuceneSearchIndexesContext.indexNames() to hibern…
Browse files Browse the repository at this point in the history
…ateSearchIndexNames()

To align with Elasticsearch and factorize this method in the next
commits.
  • Loading branch information
yrodiere committed Jun 14, 2021
1 parent 2752b4d commit 4b85131
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 25 deletions.
Expand Up @@ -53,7 +53,7 @@ public LuceneIndexScopeImpl(SearchBackendContext backendContext,
public String toString() {
return new StringBuilder( getClass().getSimpleName() )
.append( "[" )
.append( "indexNames=" ).append( searchContext.indexes().indexNames() )
.append( "indexNames=" ).append( searchContext.indexes().hibernateSearchIndexNames() )
.append( "]" )
.toString();
}
Expand Down Expand Up @@ -85,7 +85,7 @@ public SearchAggregationBuilderFactory<? super LuceneSearchQueryElementCollector

@Override
public IndexReader openIndexReader(Set<String> routingKeys) {
Set<String> indexNames = searchContext.indexes().indexNames();
Set<String> indexNames = searchContext.indexes().hibernateSearchIndexNames();
Collection<? extends LuceneSearchIndexContext> indexManagerContexts = searchContext.indexes().elements();
return HibernateSearchMultiReader.open( indexNames, indexManagerContexts, routingKeys );
}
Expand Down
Expand Up @@ -64,7 +64,7 @@ public Collection<LuceneScopeIndexManagerContext> elements() {
}

@Override
public Set<String> indexNames() {
public Set<String> hibernateSearchIndexNames() {
return indexNames;
}

Expand Down
Expand Up @@ -41,9 +41,9 @@ public <A> void contribute(LuceneSearchAggregationCollector collector,
}

LuceneSearchAggregation<A> casted = (LuceneSearchAggregation<A>) aggregation;
if ( !indexes.indexNames().equals( casted.getIndexNames() ) ) {
if ( !indexes.hibernateSearchIndexNames().equals( casted.getIndexNames() ) ) {
throw log.aggregationDefinedOnDifferentIndexes(
aggregation, casted.getIndexNames(), indexes.indexNames()
aggregation, casted.getIndexNames(), indexes.hibernateSearchIndexNames()
);
}

Expand Down
Expand Up @@ -48,7 +48,7 @@ public EventContext eventContext() {
}

private EventContext indexesEventContext() {
return EventContexts.fromIndexNames( indexesContext.indexNames() );
return EventContexts.fromIndexNames( indexesContext.hibernateSearchIndexNames() );
}

protected abstract EventContext relativeEventContext();
Expand Down
Expand Up @@ -19,7 +19,7 @@ public interface LuceneSearchIndexesContext {

Map<String, ? extends LuceneSearchIndexContext> mappedTypeNameToIndex();

Set<String> indexNames();
Set<String> hibernateSearchIndexNames();

DocumentIdentifierValueConverter<?> idDslConverter(ValueConvert valueConvert);

Expand Down
Expand Up @@ -23,7 +23,7 @@ public abstract class AbstractLuceneSearchPredicate implements LuceneSearchPredi
private final boolean constantScore;

protected AbstractLuceneSearchPredicate(AbstractBuilder builder) {
indexNames = builder.searchContext.indexes().indexNames();
indexNames = builder.searchContext.indexes().hibernateSearchIndexNames();
boost = builder.boost;
constantScore = builder.constantScore;
}
Expand Down
Expand Up @@ -31,9 +31,9 @@ static LuceneSearchPredicate from(LuceneSearchContext searchContext, SearchPredi
throw log.cannotMixLuceneSearchQueryWithOtherPredicates( predicate );
}
LuceneSearchPredicate casted = (LuceneSearchPredicate) predicate;
if ( !searchContext.indexes().indexNames().equals( casted.indexNames() ) ) {
if ( !searchContext.indexes().hibernateSearchIndexNames().equals( casted.indexNames() ) ) {
throw log.predicateDefinedOnDifferentIndexes( predicate, casted.indexNames(),
searchContext.indexes().indexNames() );
searchContext.indexes().hibernateSearchIndexNames() );
}
return casted;
}
Expand Down
Expand Up @@ -134,7 +134,7 @@ public NestedPredicateBuilder nested(String absoluteFieldPath) {
LuceneSearchCompositeIndexSchemaElementContext field = indexes.field( absoluteFieldPath ).toObjectField();
if ( !field.nested() ) {
throw log.nonNestedFieldForNestedQuery( absoluteFieldPath,
EventContexts.fromIndexNames( indexes.indexNames() ) );
EventContexts.fromIndexNames( indexes.hibernateSearchIndexNames() ) );
}
return field.queryElement( PredicateTypeKeys.NESTED, searchContext );
}
Expand Down
Expand Up @@ -123,7 +123,7 @@ public void simpleQueryString(String simpleQueryString) {
public void analyzer(String analyzerName) {
this.overrideAnalyzer = analysisDefinitionRegistry.getAnalyzerDefinition( analyzerName );
if ( overrideAnalyzer == null ) {
throw log.unknownAnalyzer( analyzerName, EventContexts.fromIndexNames( indexes.indexNames() ) );
throw log.unknownAnalyzer( analyzerName, EventContexts.fromIndexNames( indexes.hibernateSearchIndexNames() ) );
}
}

Expand Down
Expand Up @@ -19,7 +19,7 @@ class LuceneUserProvidedLuceneQueryPredicate implements LuceneSearchPredicate {
private final Query luceneQuery;

LuceneUserProvidedLuceneQueryPredicate(LuceneSearchContext searchContext, Query luceneQuery) {
this.indexNames = searchContext.indexes().indexNames();
this.indexNames = searchContext.indexes().hibernateSearchIndexNames();
this.luceneQuery = luceneQuery;
}

Expand Down
Expand Up @@ -20,7 +20,7 @@ abstract class AbstractLuceneProjection<E, P> implements LuceneSearchProjection<
}

AbstractLuceneProjection(LuceneSearchContext searchContext) {
this.indexNames = searchContext.indexes().indexNames();
this.indexNames = searchContext.indexes().hibernateSearchIndexNames();
}

@Override
Expand Down
Expand Up @@ -68,9 +68,9 @@ static <P> LuceneSearchProjection<?, P> from(LuceneSearchContext searchContext,
throw log.cannotMixLuceneSearchQueryWithOtherProjections( projection );
}
LuceneSearchProjection<?, P> casted = (LuceneSearchProjection<?, P>) projection;
if ( !searchContext.indexes().indexNames().equals( casted.indexNames() ) ) {
if ( !searchContext.indexes().hibernateSearchIndexNames().equals( casted.indexNames() ) ) {
throw log.projectionDefinedOnDifferentIndexes( projection, casted.indexNames(),
searchContext.indexes().indexNames() );
searchContext.indexes().hibernateSearchIndexNames() );
}
return casted;
}
Expand Down
Expand Up @@ -117,7 +117,7 @@ public long fetchTotalHitCount() {

@Override
public LuceneSearchScroll<H> scroll(int chunkSize) {
Set<String> indexNames = searchContext.indexes().indexNames();
Set<String> indexNames = searchContext.indexes().hibernateSearchIndexNames();
HibernateSearchMultiReader indexReader = HibernateSearchMultiReader.open(
indexNames, searchContext.indexes().elements(), routingKeys );
return new LuceneSearchScrollImpl<>( queryOrchestrator, workFactory, searchContext, routingKeys, timeoutManager,
Expand Down Expand Up @@ -202,7 +202,7 @@ private Explanation doExplain(String typeName, String id) {

private <T> T doSubmit(ReadWork<T> work) {
return queryOrchestrator.submit(
searchContext.indexes().indexNames(),
searchContext.indexes().hibernateSearchIndexNames(),
searchContext.indexes().elements(),
routingKeys,
work
Expand Down
Expand Up @@ -72,7 +72,7 @@ public void close() {
indexReader.close();
}
catch (IOException | RuntimeException e) {
log.unableToCloseIndexReader( EventContexts.fromIndexNames( searchContext.indexes().indexNames() ), e );
log.unableToCloseIndexReader( EventContexts.fromIndexNames( searchContext.indexes().hibernateSearchIndexNames() ), e );
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ private LuceneSearchScrollResult<H> doNext() {
}
catch (IOException e) {
throw log.ioExceptionOnQueryExecution( searcher.getLuceneQueryForExceptions(), e.getMessage(),
EventContexts.fromIndexNames( searchContext.indexes().indexNames() ), e );
EventContexts.fromIndexNames( searchContext.indexes().hibernateSearchIndexNames() ), e );
}

/*
Expand All @@ -134,7 +134,7 @@ private LuceneSearchScrollResult<H> doNext() {

private <T> T doSubmitWithIndexReader(ReadWork<T> work, HibernateSearchMultiReader indexReader) {
return queryOrchestrator.submit(
searchContext.indexes().indexNames(),
searchContext.indexes().hibernateSearchIndexNames(),
searchContext.indexes().elements(),
routingKeys,
work, indexReader
Expand Down
Expand Up @@ -20,7 +20,7 @@ protected AbstractLuceneSort(AbstractBuilder builder) {
}

protected AbstractLuceneSort(LuceneSearchContext searchContext) {
indexNames = searchContext.indexes().indexNames();
indexNames = searchContext.indexes().hibernateSearchIndexNames();
}

@Override
Expand Down
Expand Up @@ -26,8 +26,8 @@ static LuceneSearchSort from(LuceneSearchContext searchContext, SearchSort sort)
throw log.cannotMixLuceneSearchSortWithOtherSorts( sort );
}
LuceneSearchSort casted = (LuceneSearchSort) sort;
if ( !searchContext.indexes().indexNames().equals( casted.indexNames() ) ) {
throw log.sortDefinedOnDifferentIndexes( sort, casted.indexNames(), searchContext.indexes().indexNames() );
if ( !searchContext.indexes().hibernateSearchIndexNames().equals( casted.indexNames() ) ) {
throw log.sortDefinedOnDifferentIndexes( sort, casted.indexNames(), searchContext.indexes().hibernateSearchIndexNames() );
}
return casted;
}
Expand Down
Expand Up @@ -26,7 +26,7 @@ public abstract class AbstractLuceneBucketAggregation<K, V> extends AbstractLuce

AbstractLuceneBucketAggregation(AbstractBuilder<K, V> builder) {
super( builder );
this.indexNames = builder.searchContext.indexes().indexNames();
this.indexNames = builder.searchContext.indexes().hibernateSearchIndexNames();
this.absoluteFieldPath = builder.field.absolutePath();
}

Expand Down

0 comments on commit 4b85131

Please sign in to comment.