Quantcast

string field does not yield exact match result using qf parameter

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

string field does not yield exact match result using qf parameter

kirpakaroji
  I have a question regarding boosting the exact match queries to top, followed by partial match and if there is no exact match then give me partial match. The following 2 solutions have yielded different results, and I was not clear on it why

   This is the schema I have

   <field name="f1" type="string" indexed="true" stored="true" />
   <field name="f2" type="text_general" indexed="false" stored="true" multiValued="true"/>
   <field name="f3" type="pt_field" indexed="true" stored="true" />
   <copyField source="f1" dest="f3" />
   <uniqueKey>f1</uniqueKey>

    <fieldType name="pt_field" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="0"/>

        <filter class="solr.StopFilterFactory" ignoreCase="true" words="./lang/stopwords_pt.txt" enablePositionIncrements="true"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/>
      </analyzer>
    </fieldType>

in my solrconfig.xml I have
       <str name="df">f1</str>
       <str name="qf">f1^10 f3^1</str>
       <str name="pf">f1^10 f3^1</str>

now if I try to specify the query with these parameters in solrconfig.xml, 99% of the time exactmatch first and then partial match 1%of the time the exact match result is in the index but does not show on the results and does not give any partial matches for that query either.

    But if I make it qf=f3&pf=f1^10 f3^1 yields the exactmatch result on top 100% of the time.

   Why I am seeing this behavior.

is there anyway to say qf=f1 on the interface and get only exact results if present (in this case though f1 is string but the q parameter has spaces. do I need to use pf field
   I am using dismax query parser.

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string field does not yield exact match result using qf parameter

Jan Høydahl / Cominvent
Hi,

The "pf" feature will only kick in for phrases, i.e. multiple tokens. Per definition a "string" is one single token, so it will never kick in for strings.

A workaround can be found here: https://github.com/cominvent/exactmatch

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

30. apr. 2013 kl. 20:52 skrev kirpakaroji <[hidden email]>:

>  I have a question regarding boosting the exact match queries to top,
> followed by partial match and if there is no exact match then give me
> partial match. The following 2 solutions have yielded different results, and
> I was not clear on it why
>
>   This is the schema I have
>
>   <field name="f1" type="string" indexed="true" stored="true" />
>   <field name="f2" type="text_general" indexed="false" stored="true"
> multiValued="true"/>
>   <field name="f3" type="pt_field" indexed="true" stored="true" />
>   <copyField source="f1" dest="f3" />
>   <uniqueKey>f1</uniqueKey>
>
>    <fieldType name="pt_field" class="solr.TextField"
> positionIncrementGap="100">
>      <analyzer type="index">
>        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>        <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="1" splitOnCaseChange="0"/>
>
>        <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="./lang/stopwords_pt.txt" enablePositionIncrements="true"/>
>        <filter class="solr.LowerCaseFilterFactory" />
>        <filter class="solr.SnowballPorterFilterFactory"
> language="Portuguese"/>
>      </analyzer>
>    </fieldType>
>
> in my solrconfig.xml I have
>       <str name="df">f1</str>
>       <str name="qf">f1^10 f3^1</str>
>       <str name="pf">f1^10 f3^1</str>
>
> now if I try to specify the query with these parameters in solrconfig.xml,
> 99% of the time exactmatch first and then partial match 1%of the time the
> exact match result is in the index but does not show on the results and does
> not give any partial matches for that query either.
>
>    But if I make it qf=f3&pf=f1^10 f3^1 yields the exactmatch result on top
> 100% of the time.
>
>   Why I am seeing this behavior.
>
> is there anyway to say qf=f1 on the interface and get only exact results if
> present (in this case though f1 is string but the q parameter has spaces. do
> I need to use pf field
>   I am using dismax query parser.
>
> Thanks
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/string-field-does-not-yield-exact-match-result-using-qf-parameter-tp4060096.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string field does not yield exact match result using qf parameter

kirpakaroji
Hi Jan

my question is when I tweak pf and qf parameter and the results change slightly and I do not think for exact match you need to implement the solution that you mentioned in your reply. you can always have string field and in your pf parameter you can boost that field to get the exact match results on top.

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string field does not yield exact match result using qf parameter

Jan Høydahl / Cominvent
Hi,

You can try to increase the "pf" boost for your string field, I don't think you'll have success in having it boosted with pf since it's a string? Check explain output with &debugQuery=true and see whether you get a phrase boost.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

2. mai 2013 kl. 19:16 skrev kirpakaroji <[hidden email]>:

> Hi Jan
>
> my question is when I tweak pf and qf parameter and the results change
> slightly and I do not think for exact match you need to implement the
> solution that you mentioned in your reply. you can always have string field
> and in your pf parameter you can boost that field to get the exact match
> results on top.
>
> Thanks
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/string-field-does-not-yield-exact-match-result-using-qf-parameter-tp4060096p4060492.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Loading...