Java Code Examples for org.apache.lucene.search.IndexSearcher#setMaxClauseCount()

The following examples show how to use org.apache.lucene.search.IndexSearcher#setMaxClauseCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestQPHelper.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testBooleanQuery() throws Exception {
  IndexSearcher.setMaxClauseCount(2);
  expectThrows(QueryNodeException.class, () -> {
    StandardQueryParser qp = new StandardQueryParser();
    qp.setAnalyzer(new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false));

    qp.parse("one two three", "field");
  });
}
 
Example 2
Source File: TestNumericRangeQuery32.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
  super.setUp();
  // set the theoretical maximum term count for 8bit (see docs for the number)
  // super.tearDown will restore the default
  IndexSearcher.setMaxClauseCount(3*255*2 + 255);
}
 
Example 3
Source File: TestNumericRangeQuery64.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
  super.setUp();
  // set the theoretical maximum term count for 8bit (see docs for the number)
  // super.tearDown will restore the default
  IndexSearcher.setMaxClauseCount(7*255*2 + 255);
}
 
Example 4
Source File: TestRuleSetupAndRestoreInstanceEnv.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
protected void after() {
  IndexSearcher.setMaxClauseCount(savedBoolMaxClauseCount);
}
 
Example 5
Source File: TestPrecedenceQueryParser.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public void testBooleanQuery() throws Exception {
  IndexSearcher.setMaxClauseCount(2);
  expectThrows(QueryNodeException.class, () -> {
    getParser(new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)).parse("one two three", "field");
  });
}
 
Example 6
Source File: TestPrecedenceQueryParser.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}
 
Example 7
Source File: TestQPHelper.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}
 
Example 8
Source File: QueryParserTestBase.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public void testBooleanQuery() throws Exception {
  IndexSearcher.setMaxClauseCount(2);
  Analyzer purWhitespaceAnalyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false);
  assertParseException("one two three", purWhitespaceAnalyzer);
}
 
Example 9
Source File: QueryParserTestBase.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}