<commit_before>/*
 * Copyright 2012 Greplin, Inc. All Rights Reserved.
 */

package com.greplin.lucene.query;

import com.google.common.base.Objects;
import com.greplin.lucene.predicate.BitsProvider;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.ToStringUtils;

import java.io.IOException;
import java.util.Set;

/**
 * Query that is filtered through a simple predicate function.
 *
 * Based on {@link org.apache.lucene.search.CachingWrapperFilter}.
 */
public class PredicateQuery extends Query {

  /**
   * The underlying query.
   */
  private final Query query;


  /**
   * The predicate to match against.
   */
  private final BitsProvider predicate;


  /**
   * Constructs a new query which applies a predicate to filter the results
   * of the original query.
   * @param query Query to be filtered.
   * @param predicate Provider of predicates to apply to the query.
   */
  public PredicateQuery(final Query query, final BitsProvider predicate) {
    this.query = query;<commit_msg>- Increasing BooleanQuery max-clause-count in PredicateQuery<commit_after>/*
 * Copyright 2012 Greplin, Inc. All Rights Reserved.
 */

package com.greplin.lucene.query;

import com.google.common.base.Objects;
import com.greplin.lucene.predicate.BitsProvider;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.ToStringUtils;

import java.io.IOException;
import java.util.Set;

/**
 * Query that is filtered through a simple predicate function.
 *
 * Based on {@link org.apache.lucene.search.CachingWrapperFilter}.
 */
public class PredicateQuery extends Query {

  /**
   * Double the standard max-clause count for BooleanQueries (1024) since it is
   * often too low for large rewrites.
   */
  private static final int MAX_CLAUSE_COUNT = 2048;

  static {
    BooleanQuery.setMaxClauseCount(MAX_CLAUSE_COUNT);
  }

  /**
   * The underlying query.
   */
  private final Query query;


  /**
   * The predicate to match against.
   */
  private final BitsProvider predicate;


  /**
   * Constructs a new query which applies a predicate to filter the results
   * of the original query.
   * @param query Query to be filtered.
   * @param predicate Provider of predicates to apply to the query.
   */
  public PredicateQuery(final Query query, final BitsProvider predicate) {
    this.query = query;
{'fraction_non_alphanumeric': 0.09850175326745297, 'fraction_numerical': 0.005100414408670704, 'mean_word_length': 3.988871224165342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '135081', 'n_tokens_mistral': 1009, 'n_tokens_neox': 935, 'n_words': 261}