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

The following examples show how to use org.apache.lucene.search.IndexSearcher#setMaxClauseCount() . These examples are extracted from open source projects. 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 Project: lucene-solr   File: TestQPHelper.java    License: 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
@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
@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
@Override
protected void after() {
  IndexSearcher.setMaxClauseCount(savedBoolMaxClauseCount);
}
 
Example 5
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
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}
 
Example 7
Source Project: lucene-solr   File: TestQPHelper.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}
 
Example 8
Source Project: lucene-solr   File: QueryParserTestBase.java    License: 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 Project: lucene-solr   File: QueryParserTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void tearDown() throws Exception {
  IndexSearcher.setMaxClauseCount(originalMaxClauses);
  super.tearDown();
}