All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.query.dsl.impl.ConnectedPhraseContext Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */

package org.hibernate.search.query.dsl.impl;

import org.apache.lucene.search.Filter;

import org.hibernate.search.query.dsl.PhraseContext;
import org.hibernate.search.query.dsl.PhraseMatchingContext;

/**
 * @author Emmanuel Bernard
 */
class ConnectedPhraseContext implements PhraseContext {
	private final QueryBuildingContext queryContext;
	private final QueryCustomizer queryCustomizer;
	private final PhraseQueryContext phraseContext;


	public ConnectedPhraseContext(QueryBuildingContext queryContext) {
		this.queryCustomizer = new QueryCustomizer();
		this.phraseContext = new PhraseQueryContext();
		this.queryContext = queryContext;
	}

	@Override
	public PhraseContext withSlop(int slop) {
		phraseContext.setSlop( slop );
		return this;
	}

	@Override
	public PhraseMatchingContext onField(String fieldName) {
		return new ConnectedPhraseMatchingContext( fieldName, phraseContext, queryCustomizer, queryContext );
	}

	@Override
	public PhraseContext boostedTo(float boost) {
		queryCustomizer.boostedTo( boost );
		return this;
	}

	@Override
	public PhraseContext withConstantScore() {
		queryCustomizer.withConstantScore();
		return this;
	}

	@Override
	public PhraseContext filteredBy(Filter filter) {
		queryCustomizer.filteredBy( filter );
		return this;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy