Solr
  1. Solr
  2. SOLR-218

Support for Lucene QueryParser properties via solrconfig.xml file

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0
    • Fix Version/s: 4.9, 5.0
    • Component/s: search
    • Labels:
      None

      Description

      The SolrQueryParser class, which extends Lucene's QueryParser class, does not provide any way of setting the various QueryParser properties via the solr config file (solrconfig.xml). These properties include:

      allowLeadingWildcard (Set to true to allow * and ? as the first character of a PrefixQuery and WildcardQuery)
      dateResolution: Sets the default date resolution used by RangeQueries for fields for which no specific date resolutions has been set.
      defaultOperator: Sets the boolean operator of the QueryParser.
      fuzzyMinSim: Set the minimum similarity for fuzzy queries.
      locale: Set locale used by date range parsing.
      lowercaseExpandedTerms: Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not.
      phraseSlop: Sets the default slop for phrases.
      useOldRangeQuery: By default QueryParser uses new ConstantScoreRangeQuery in preference to RangeQuery for range queries.

      This can be achieved by calling the setter methods for these properties in the SolrQueryParser constructor,

      public SolrQueryParser(IndexSchema schema, String defaultField)

      { super(defaultField == null ? schema.getDefaultSearchFieldName() : defaultField, schema.getQueryAnalyzer()); this.schema = schema; setAllowLeadingWildcard(SolrConfig.config.getBool("query/setAllowLeadingWildcard")); setLowercaseExpandedTerms(SolrConfig.config.getBool("query/lowerCaseExpandedTerms")); }

      In addition, solr should not modify these values from the defaults provided by Lucene, as it currently does by calling setLowercaseExpandedTerms(false) in this method.

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Michael Pelz-Sherman
            • Votes:
              19 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

              • Created:
                Updated:

                Development