List of usage examples for org.apache.lucene.queryparser.flexible.core.processors QueryNodeProcessorPipeline add
@Override public boolean add(QueryNodeProcessor processor)
From source file:com.sindicetech.siren.qparser.keyword.BasicSyntaxTest.java
License:Open Source License
@Test(expected = IllegalArgumentException.class) public void testTwigQueryNodeWithMoreThan2Children() throws Exception { final StandardExtendedKeywordQueryParser parser = new StandardExtendedKeywordQueryParser(); final QueryNodeProcessorPipeline pipeline = new QueryNodeProcessorPipeline(); pipeline.add(new QueryNodeProcessorImpl() { @Override// ww w . j av a2 s. c om protected List<QueryNode> setChildrenOrder(final List<QueryNode> children) throws QueryNodeException { return children; } @Override protected QueryNode preProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof TwigQueryNode) { node.add(new FieldQueryNode("field", "text", 0, 4)); } return node; } @Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { return node; } }); parser.setQueryNodeProcessor(pipeline); parser.parse("a : b", SirenTestCase.DEFAULT_TEST_FIELD); }
From source file:org.sindice.siren.qparser.keyword.KeywordQueryParserTest.java
License:Apache License
@Test(expected = IllegalArgumentException.class) public void testTwigQueryNodeWithMoreThan2Children() throws Exception { final KeywordQueryParser parser = new KeywordQueryParser(); final QueryNodeProcessorPipeline pipeline = new QueryNodeProcessorPipeline(); pipeline.add(new QueryNodeProcessorImpl() { @Override//from ww w. j a v a 2 s . c o m protected List<QueryNode> setChildrenOrder(final List<QueryNode> children) throws QueryNodeException { return children; } @Override protected QueryNode preProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof TwigQueryNode) { node.add(new FieldQueryNode("field", "text", 0, 4)); } return node; } @Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { return node; } }); parser.setQueryNodeProcessor(pipeline); parser.parse("a : b", SirenTestCase.DEFAULT_TEST_FIELD); }