Esempio n. 1
0
  /**
   * Sets the boolean operator of the QueryParser. In default mode ( {@link Operator#OR}) terms
   * without any modifiers are considered optional: for example <code>capital of Hungary</code> is
   * equal to <code>capital OR of OR Hungary</code>.<br>
   * In {@link Operator#AND} mode terms are considered to be in conjunction: the above mentioned
   * query is parsed as <code>capital AND of AND Hungary</code>
   */
  public void setDefaultOperator(final Operator operator) {
    this.getQueryConfigHandler().set(ConfigurationKeys.DEFAULT_OPERATOR, operator);

    // ensure that the default operator of the keyword parser is in synch
    final KeywordQueryParser keywordParser = this.getKeywordQueryParser();
    keywordParser.setDefaultOperator(this.getDefaultOperator());
  }
Esempio n. 2
0
  @Override
  public void setQueryConfigHandler(final QueryConfigHandler config) {
    super.setQueryConfigHandler(config);

    final KeywordQueryParser keywordParser = this.getKeywordQueryParser();
    // ensure that the default operator of the keyword parser is in synch
    keywordParser.setDefaultOperator(this.getDefaultOperator());

    // configure builders with the keyword parser
    final JsonQueryTreeBuilder builder = (JsonQueryTreeBuilder) this.getQueryBuilder();
    builder.setBuilders(keywordParser);
  }
Esempio n. 3
0
  public JsonQueryParser() {
    super(
        new JsonQueryConfigHandler(),
        new JsonSyntaxParser(),
        new JsonQueryNodeProcessorPipeline(null),
        new JsonQueryTreeBuilder(null));

    final KeywordQueryParser keywordParser = this.getKeywordQueryParser();
    // ensure that the default operator of the keyword parser is in synch
    keywordParser.setDefaultOperator(this.getDefaultOperator());

    // configure builders with the keyword parser
    final JsonQueryTreeBuilder builder = (JsonQueryTreeBuilder) this.getQueryBuilder();
    builder.setBuilders(keywordParser);
  }
Esempio n. 4
0
  /**
   * Set the keyword query parser that will be used to parse boolean expressions found in the JSON
   * query objects.
   */
  public void setKeywordQueryParser(final KeywordQueryParser keywordParser) {
    // ensure that the default operator of the keyword parser is in synch
    keywordParser.setDefaultOperator(this.getDefaultOperator());

    // set keyword query parser
    this.getQueryConfigHandler().set(ConfigurationKeys.KEYWORD_PARSER, keywordParser);

    // configure builders with the new keyword parser
    final JsonQueryTreeBuilder builder = (JsonQueryTreeBuilder) this.getQueryBuilder();
    builder.setBuilders(keywordParser);
  }