You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "GOYAL, ANKUR" <ag...@att.com> on 2013/11/19 16:27:41 UTC

Leading and trailing wildcard with phrase query and positional ordering

Hi,

I am using Solr 4.2.1. I have a couple of questions regarding using leading and trailing wildcards with phrase queries and doing positional ordering.

*       I have a field called text which is defined as the text_general field. I downloaded the ComplexPhraseQuery plugin (https://issues.apache.org/jira/browse/SOLR-1604) and it works perfectly for trailing wildcards and wildcards within the phrase. However, if we use a leading wildcard, then it leads to an error saying that WildCard query does not permit usage of leading wildcard. So, is there any other way that we can use leading and trailing wildcards along with a phrase ?
*       I am using boosting (qf parameter in requestHandler in solrConfig.xml) to do ordering of results that are returned from Solr. However, the order is not correct. The fields that I am doing boosting on are "text_general" fields. So, is it possible that boosting does not occur when the wildcards are used ?

-Ankur


Re: Leading and trailing wildcard with phrase query and positional ordering

Posted by Dmitry Kan <so...@gmail.com>.
Hi Ankur,

For the leading wildcard you may want to try the
ReversedWildcardFilterFactory:

https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-ReversedWildcardFilter

in the code of CPQ there is a loop over filters of your text field and a
specific check:

          if (factory instanceof ReversedWildcardFilterFactory) {
            allow = true;
            leadingWildcards.put(e.getKey(),
(ReversedWildcardFilterFactory) factory);
          }

HTH,

Dmitry




On Tue, Nov 19, 2013 at 5:27 PM, GOYAL, ANKUR <ag...@att.com> wrote:

> Hi,
>
> I am using Solr 4.2.1. I have a couple of questions regarding using
> leading and trailing wildcards with phrase queries and doing positional
> ordering.
>
> *       I have a field called text which is defined as the text_general
> field. I downloaded the ComplexPhraseQuery plugin (
> https://issues.apache.org/jira/browse/SOLR-1604) and it works perfectly
> for trailing wildcards and wildcards within the phrase. However, if we use
> a leading wildcard, then it leads to an error saying that WildCard query
> does not permit usage of leading wildcard. So, is there any other way that
> we can use leading and trailing wildcards along with a phrase ?
> *       I am using boosting (qf parameter in requestHandler in
> solrConfig.xml) to do ordering of results that are returned from Solr.
> However, the order is not correct. The fields that I am doing boosting on
> are "text_general" fields. So, is it possible that boosting does not occur
> when the wildcards are used ?
>
> -Ankur
>
>


-- 
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: twitter.com/dmitrykan