You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Michael Pelz-Sherman (JIRA)" <ji...@apache.org> on 2007/04/28 00:55:15 UTC

[jira] Created: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Support for Lucene QueryParser properties via solrconfig.xml file
-----------------------------------------------------------------

                 Key: SOLR-218
                 URL: https://issues.apache.org/jira/browse/SOLR-218
             Project: Solr
          Issue Type: Improvement
          Components: search
    Affects Versions: 1.1.0
            Reporter: Michael Pelz-Sherman


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.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492433 ] 

Yonik Seeley commented on SOLR-218:
-----------------------------------

> Meanwhile, I will look at writing a plugin so I can get the functionality I need without having to modify the Solr source.

I'm confident this will be fixed, but in the meantime isn't the simplest solution to lowercase any prefix or wildcard query in the client?


> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492427 ] 

Yonik Seeley commented on SOLR-218:
-----------------------------------

With regards to doing something like lowercasing wildcard queries, that should be a per-field setting for Solr.
But as I stated here: http://www.nabble.com/case-sensitivity-tf3654523.html
I think Solr should figure out the right thing to do automatically.
The implementation should probably be a method on FieldType that handles lowercasing (or otherwise manipulating) the wildcard query if necessary, or perhaps throwing an exception if it's just not supported for that field type.


> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502020 ] 

Hoss Man commented on SOLR-218:
-------------------------------

reminder: when addressing this, we should make sure there is an option for turning of ConstantScorePrefixQuery as well .. some people may prefer the stock lucene behavior (particularly if no good solution is found for SOLR-195)

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Jonas Salk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700531#action_12700531 ] 

Jonas Salk commented on SOLR-218:
---------------------------------

Not an expert at SOLR, currently using the default configurations which are shipped with it.   Taking suggestions above to update SolrQueryParser to allow for leading wildcard as allowed by Lucene, i modified the following 2 methods:

public SolrQueryParser(IndexSchema schema, String defaultField) {
     ... 
    // added 
    setAllowLeadingWildcard(true); 
    setLowercaseExpandedTerms(true);
    ... 
  }
 ...
  public SolrQueryParser(QParser parser, String defaultField, Analyzer analyzer) {
    ... 
    setAllowLeadingWildcard(true); 
    setLowercaseExpandedTerms(true);
    ... 
  }

everything compiled and 'ant' built a distro.   However, still throws an exception on a query request:

Test query:  "http://localhost:8983/solr/select/?indent=on&q=CommentText:Hello"

Finds two documents.   

However, wildcard query:  "http://localhost:8983/solr/select/?indent=on&q=CommentText:*ello"

throws this exception:
org.apache.lucene.queryParser.ParseException: Cannot parse 'CommentText:*ello': '*' or '?' not allowed as first character in WildcardQuery

Any suggestions on how i can prevent this exception and get this to work?

Regards,
Jonas

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.5
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Jonas Salk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700793#action_12700793 ] 

Jonas Salk edited comment on SOLR-218 at 4/20/09 6:54 AM:
----------------------------------------------------------

That is good to hear Mark.   Would you mind taking a few minutes and putting down exact code changes you made?    I want to backtrack everything i did to ensure, I've not made some mistakes.   I've basically updated only one Java file:  SolrQueryParser.java.  

I'm using:  apache-solr-1.3.0 
Jonas

SolrQueryParser.java
------------------------------
public SolrQueryParser(IndexSchema schema, String defaultField) {
 ... 
// added 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true);
 ...
 }
...
public SolrQueryParser(QParser parser, String defaultField, Analyzer analyzer)
 { 
... 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true); 
...
 }

      was (Author: jonas3000):
    That is good to hear Mark.   Would you mind taking a few minutes and putting down exact code changes you made?    I want to backtrack everything i did to ensure, I've not made some mistakes.   I've basically updated only one Java file: 
Jonas

SolrQueryParser.java
------------------------------
public SolrQueryParser(IndexSchema schema, String defaultField) {
 ... 
// added 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true);
 ...
 }
...
public SolrQueryParser(QParser parser, String defaultField, Analyzer analyzer)
 { 
... 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true); 
...
 }
  
> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.5
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492418 ] 

Hoss Man commented on SOLR-218:
-------------------------------

1) these options shouldn't be specified in the solrconfig.xml, they should come from the schema.xml (since knowing whether you want these options tends to depends on how you have configured the fields) ... the <solrQueryParser .. /> directive already exists for this purpose, and defaultOperator is already supported.

2) these settings shouldn't be applied in the constructor for SolrQueryParser per the contract described in it's comment...
  /**
   * Constructs a SolrQueryParser using the schema to understand the
   * formats and datatypes of each field.  Only the defaultSearchField
   * will be used from the IndexSchema (unless overridden),
   * &lt;solrQueryParser&gt; will not be used.
...changing that makes it very hard for plugin writers to subclass SolrQueryParser to get a schema aware parser with no other changes.  This is what QueryParsing.parseQuery is for (although i fully support a new factory method for returning an instance of a SolrQueryParser with these options set on it.

3) options like dateResolution assume use of DateTools which is not what DateField uses ... it's possible some users might be using StrField and using DateTools to format it on the client side, but we should think carefully before adding this option.

4) do we want another option to enable/disable the use of PrefixFilter for prefix queries that is currently in SolrQueryParser?  it does cause problems with highlighting prefix queries.

5) regarding this comment...

> 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.

...while i fully agree with this sentiment, changing now to align ourselves with the Lucene default would break backwards compatibility for existing Solr users.  if the option is not used i the schema.xml, we need to assume setLowercaseExpandedTerms(false).


> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700588#action_12700588 ] 

Mark Miller commented on SOLR-218:
----------------------------------

Hey Jonas, I just did the same and it worked no problem.

Perhaps try a clean and build the project again?

I grabbed a fresh checkout of Solr, loaded the example docs, tried your search but with the 'name:*pod'  and it blew up as expected.

I made the changes, ran example again, and the queries worked as expected.

Anything of importance that you have going on different there?

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.5
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Michael Pelz-Sherman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492429 ] 

Michael Pelz-Sherman commented on SOLR-218:
-------------------------------------------

I just don't see how it's possible for Solr to "figure out the right thing to do automatically" in every case.

Even if this were possible, I don't see how it harms Solr to offer access to these configuration parameters. Whether this is done through the solrconfig.xml or the schema.xml isn't really important to me; I would just like to have some way of adjusting these parameters without having to write a plugin. If it can be a per-field setting, great, but it's nice to have a global setting as well.

As for setLowercaseExpandedTerms(), it seems to me that Solr should not override the default settings provided by Lucene without a very solid reason. For such a young product, I question whether backward compatibility is a valid justification for doing so.

Anyway, thanks very much for considering this. Meanwhile, I will look at writing a plugin so I can get the functionality I need without having to modify the Solr source. 

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Michael Kimsal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493103 ] 

Michael Kimsal commented on SOLR-218:
-------------------------------------

    setAllowLeadingWildcard(SolrConfig.config.getBool("query/setAllowLeadingWildcard"));
    setLowercaseExpandedTerms(SolrConfig.config.getBool("query/lowerCaseExpandedTerms")); 
=============================================================================

>From what I understand, these sorts of things could likely be handled by custom query parsers.  However, 
I'm voting for this because I'd like to see the ability to configure these items globally first, as well as 
already having the option to write custom query parsers if needed.  This provides an easier way to 
configure the behaviour without needing to write code or recompile anything.

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar updated SOLR-218:
---------------------------------------

    Fix Version/s: 1.4

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Jonas Salk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700793#action_12700793 ] 

Jonas Salk commented on SOLR-218:
---------------------------------

That is good to hear Mark.   Would you mind taking a few minutes and putting down exact code changes you made?    I want to backtrack everything i did to ensure, I've not made some mistakes.   I've basically updated only one Java file: 
Jonas

SolrQueryParser.java
------------------------------
public SolrQueryParser(IndexSchema schema, String defaultField) {
 ... 
// added 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true);
 ...
 }
...
public SolrQueryParser(QParser parser, String defaultField, Analyzer analyzer)
 { 
... 
setAllowLeadingWildcard(true); 
setLowercaseExpandedTerms(true); 
...
 }

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.5
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605451#action_12605451 ] 

Hoss Man commented on SOLR-218:
-------------------------------

In response to a question on the mailing list about how best to tackle this...

It's not documented very well (or: at all) at the moment, but it's now possible to declare "<queryParser>" in your solrconfig.xml, just like <requestHandler>" ... and those each correspond to a QParserPlugin.  The LuceneQParserPlugin could be modified to take in some init options and use them in it's "createParser" method to set options on the underlying
SolrQueryParser.  people could declare multiple instances of the LuceneQParserPlugin with differnet names, and use them by specifying a defType in their request -- or they could give one of those instance the name "lucene" and it will be used by default.



> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492438 ] 

Yonik Seeley commented on SOLR-218:
-----------------------------------

> I just don't see how it's possible for Solr to "figure out the right thing to do automatically" in every case. 

Here's my shot at it: SOLR-219


> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700802#action_12700802 ] 

Mark Miller commented on SOLR-218:
----------------------------------

I made the same changes, but I was using trunk. I'll give it a shot with 1.3 in a bit and report back.

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>             Fix For: 1.5
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-218) Support for Lucene QueryParser properties via solrconfig.xml file

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555260#action_12555260 ] 

Hoss Man commented on SOLR-218:
-------------------------------

quick throught for anyone that may want to tackle a patch for this... given the "recent" addition of search components, it may make sense to completley deprecate the existing <solrQueryParser .. /> directive in the schema.xml and make all of these options for the "QueryComponent" class.

(that way people can register multiple instances of the QueryComponent with different options, and hen use those alternate instances in different handler instances)

> Support for Lucene QueryParser properties via solrconfig.xml file
> -----------------------------------------------------------------
>
>                 Key: SOLR-218
>                 URL: https://issues.apache.org/jira/browse/SOLR-218
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.1.0
>            Reporter: Michael Pelz-Sherman
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.