upper case in wildcard query (SolrQueryParser issue)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

upper case in wildcard query (SolrQueryParser issue)

Yongtao Liu

Hi all,

 

If user do wildcard query and the term has upper case (like Hell*), the query will not return result.

 

I saw in org.apache.lucene.queryParser.QueryParser has function setLowercaseExpandedTerms to handle this.

Via comments, looks like default value should be true.

But in SolrQueryParser, it hardcode this value to false.

I was wondering why SolrQueryParser set it to false by default?

 

org.apache.lucene.queryParser.QueryParser

  /**

   * Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically

   * lower-cased or not.  Default is <code>true</code>.

   */

  public void setLowercaseExpandedTerms(boolean lowercaseExpandedTerms) {

    this.lowercaseExpandedTerms = lowercaseExpandedTerms;

  }

 

org.apache.solr.search.SolrQueryParser

  public SolrQueryParser(IndexSchema schema, String defaultField) {

    super(schema.getSolrConfig().getLuceneVersion("luceneMatchVersion", Version.LUCENE_24), defaultField == null ? schema.getDefaultSearchFieldName() : defaultField, schema.getQueryAnalyzer());

    this.schema = schema;

    this.parser  = null;

    this.defaultField = defaultField;

    setLowercaseExpandedTerms(false);

    setEnablePositionIncrements(true);

    checkAllowLeadingWildcards();

  }

 

 

Thanks,

Yongtao

Reply | Threaded
Open this post in threaded view
|

Re: upper case in wildcard query (SolrQueryParser issue)

Yonik Seeley-2-2
On Tue, Jul 19, 2011 at 2:47 PM, Yongtao Liu <[hidden email]> wrote:
> I was wondering why SolrQueryParser set it to false by default?

That allows one to handle both lowercased and non-lowercased fields -
the client must match the case, but at least it's possible.
If it's true, then it becomes impossible to match a term that actually
starts with an uppercase letter.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: upper case in wildcard query (SolrQueryParser issue)

Yongtao Liu
Hi Yonik,

Thanks for your email.
If all our filed use solr.LowerCaseFilterFactory filter, then we should safe to set it trun to handle upper case in wildcard query, right?

Thanks,
Yongtao
-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Yonik Seeley
Sent: Tuesday, July 19, 2011 2:59 PM
To: [hidden email]
Subject: Re: upper case in wildcard query (SolrQueryParser issue)

On Tue, Jul 19, 2011 at 2:47 PM, Yongtao Liu <[hidden email]> wrote:
> I was wondering why SolrQueryParser set it to false by default?

That allows one to handle both lowercased and non-lowercased fields - the client must match the case, but at least it's possible.
If it's true, then it becomes impossible to match a term that actually starts with an uppercase letter.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]

******************Legal Disclaimer***************************
"This communication may contain confidential and privileged
material for the sole use of the intended recipient. Any
unauthorized review, use or distribution by others is strictly
prohibited. If you have received the message in error, please
advise the sender by reply email and delete the message. Thank
you."
*********************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]