You have two problems

First, you're specifying fields in the q clause so the qf stuff
isn't respected.

My query params is something like below
 q: person_full_name:louis OR address1:louis OR city:louis OR
state_code:louis
 qf: person_full_name^5.0 address1^0.8 city^0.7 state_code^1.0
 defType: edismax

The "qf" bits are only applied to search terms that do NOT have a field
qualifier, so in this case the boosts you've specified in the qf
parameter are totally ignored. The sense you want is something like

 q: louis
 qf: person_full_name^5.0 address1^0.8 city^0.7 state_code^1.0
 defType: edismax

But that won't really help if you're doing pre  and post-fix wildcards, which I
_think_ you're doing. I'm uncertain because sometimes asteriskWORDasterisk
is just a bolding.. .But the fact that I see ConstantScoreQuery leads me to
believe that you're doing wildcards, which are not scored. And this pattern
is usually a holdover from SQL, where the only way of doing text searches is
%whatever%. Which you should really, really try not to do, it's very
inefficient.

So it would be good to understand the use-case you're trying to support, the
field types for your fields, etc. Because if it's a text type field and assuming
you're field values are things like St. Louis you shouldn't need wildcards
at all.

Best,
Erick

On Tue, Jul 21, 2015 at 9:12 PM, sandeep bonkra <sandeepbon...@gmail.com> wrote:
> Hi,
>
> I am implementing searching using SOLR 5.0 and facing very strange problem.
> I am having 4 fields Name and address, city and state in the document apart
> from a unique ID.
>
> My requirement is that it should give me those results first where there is
> a match in name , then address, then state, city
>
> Scenerio 1 : When searching *louis*
> My query params is something like below
>  q: person_full_name:*louis* OR address1:*louis* OR city:*louis* OR
> state_code:*louis*
>  qf: person_full_name^5.0 address1^0.8 city^0.7 state_code^1.0
>  defType: edismax
>
>  This is not giving results as per boost mentioned in qf param. This is
> giving me result where city is getting matched first.
> Score is coming as below:
>
>  "explain": {
>       "11470307": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(person_full_name:*louis*),
> product of:\n        1.0 = boost\n        0.0015872642 = queryNorm\n
>  0.09090909 = coord(1/11)\n",
>       "11470282": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(person_full_name:*louis*),
> product of:\n        1.0 = boost\n        0.0015872642 = queryNorm\n
>  0.09090909 = coord(1/11)\n",
>       "11470291": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(city:*louis*), product of:\n
>   1.0 = boost\n        0.0015872642 = queryNorm\n    0.09090909 =
> coord(1/11)\n",
>       "11470261": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(person_full_name:*louis*),
> product of:\n        1.0 = boost\n        0.0015872642 = queryNorm\n
>  0.09090909 = coord(1/11)\n",
>       "11470328": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(person_full_name:*louis*),
> product of:\n        1.0 = boost\n        0.0015872642 = queryNorm\n
>  0.09090909 = coord(1/11)\n",
>       "11470331": "\n1.4429675E-4 = (MATCH) sum of:\n  1.4429675E-4 =
> (MATCH) product of:\n    0.0015872642 = (MATCH) sum of:\n
> 0.0015872642 = (MATCH) ConstantScore(person_full_name:*louis*),
> product of:\n        1.0 = boost\n        0.0015872642 = queryNorm\n
>  0.09090909 = coord(1/11)\n"
>     },
>
>
> Scenerio 2: But when I am matching 2 keywords. *louis cen*
>
>
>  "explain": {
>       "11470286": "\n0.9805807 = (MATCH) product of:\n  1.9611614 =
> (MATCH) sum of:\n    0.49029034 = (MATCH) max of:\n      0.49029034 =
> (MATCH) ConstantScore(person_full_name:*cen*^5.0)^5.0, product of:\n
>      5.0 = boost\n        0.09805807 = queryNorm\n    0.49029034 =
> (MATCH) max of:\n      0.49029034 = (MATCH)
> ConstantScore(person_full_name:*cen*^5.0)^5.0, product of:\n
> 5.0 = boost\n        0.09805807 = queryNorm\n    0.49029034 = (MATCH)
> max of:\n      0.49029034 = (MATCH)
> ConstantScore(person_full_name:*cen*^5.0)^5.0, product of:\n
> 5.0 = boost\n        0.09805807 = queryNorm\n    0.49029034 = (MATCH)
> max of:\n      0.49029034 = (MATCH)
> ConstantScore(person_full_name:*cen*^5.0)^5.0, product of:\n
> 5.0 = boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470284": "\n0.15689291 = (MATCH) product of:\n  0.31378582 =
> (MATCH) sum of:\n    0.078446455 = (MATCH) max of:\n      0.078446455
> = (MATCH) ConstantScore(address1:*cen*^0.8)^0.8, product of:\n
> 0.8 = boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH)
> max of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470232": "\n0.15689291 = (MATCH) product of:\n  0.31378582 =
> (MATCH) sum of:\n    0.078446455 = (MATCH) max of:\n      0.078446455
> = (MATCH) ConstantScore(address1:*cen*^0.8)^0.8, product of:\n
> 0.8 = boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH)
> max of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11469707": "\n0.15689291 = (MATCH) product of:\n  0.31378582 =
> (MATCH) sum of:\n    0.078446455 = (MATCH) max of:\n      0.078446455
> = (MATCH) ConstantScore(address1:*cen*^0.8)^0.8, product of:\n
> 0.8 = boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH)
> max of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470341": "\n0.15689291 = (MATCH) product of:\n  0.31378582 =
> (MATCH) sum of:\n    0.078446455 = (MATCH) max of:\n      0.078446455
> = (MATCH) ConstantScore(address1:*cen*^0.8)^0.8, product of:\n
> 0.8 = boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH)
> max of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470349": "\n0.15689291 = (MATCH) product of:\n  0.31378582 =
> (MATCH) sum of:\n    0.078446455 = (MATCH) max of:\n      0.078446455
> = (MATCH) ConstantScore(address1:*cen*^0.8)^0.8, product of:\n
> 0.8 = boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH)
> max of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n    0.078446455 = (MATCH) max
> of:\n      0.078446455 = (MATCH)
> ConstantScore(address1:*cen*^0.8)^0.8, product of:\n        0.8 =
> boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470250": "\n0.11766969 = (MATCH) product of:\n  0.23533937 =
> (MATCH) sum of:\n    0.058834843 = (MATCH) max of:\n      0.058834843
> = (MATCH) ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n
>      0.6 = boost\n        0.09805807 = queryNorm\n    0.058834843 =
> (MATCH) max of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n    0.058834843 = (MATCH) max
> of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n    0.058834843 = (MATCH) max
> of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11469726": "\n0.11766969 = (MATCH) product of:\n  0.23533937 =
> (MATCH) sum of:\n    0.058834843 = (MATCH) max of:\n      0.058834843
> = (MATCH) ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n
>      0.6 = boost\n        0.09805807 = queryNorm\n    0.058834843 =
> (MATCH) max of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n    0.058834843 = (MATCH) max
> of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n    0.058834843 = (MATCH) max
> of:\n      0.058834843 = (MATCH)
> ConstantScore(specialization:*cen*^0.6)^0.6, product of:\n        0.6
> = boost\n        0.09805807 = queryNorm\n  0.5 = coord(4/8)\n",
>       "11470307": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH)
> ConstantScore(person_full_name:*louis*), product of:\n      1.0 =
> boost\n      0.09805807 = queryNorm\n  0.125 = coord(1/8)\n",
>       "11470282": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH)
> ConstantScore(person_full_name:*louis*), product of:\n      1.0 =
> boost\n      0.09805807 = queryNorm\n  0.125 = coord(1/8)\n",
>       "11470291": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH) ConstantScore(city:*louis*),
> product of:\n      1.0 = boost\n      0.09805807 = queryNorm\n  0.125
> = coord(1/8)\n",
>       "11470261": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH)
> ConstantScore(person_full_name:*louis*), product of:\n      1.0 =
> boost\n      0.09805807 = queryNorm\n  0.125 = coord(1/8)\n",
>       "11470328": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH)
> ConstantScore(person_full_name:*louis*), product of:\n      1.0 =
> boost\n      0.09805807 = queryNorm\n  0.125 = coord(1/8)\n",
>       "11470331": "\n0.012257258 = (MATCH) product of:\n  0.09805807 =
> (MATCH) sum of:\n    0.09805807 = (MATCH)
> ConstantScore(person_full_name:*louis*), product of:\n      1.0 =
> boost\n      0.09805807 = queryNorm\n  0.125 = coord(1/8)\n"
>     },
>
>
> SO THE ISSUE IS THAT SOMETIMES IT IS TAKING FILTER BUT NOT ALWAYS. What
> could be the reason.
>
> Here is tokenizer and fileter I am using:
>
> <analyzer type="index">
>       <tokenizer class="solr.StandardTokenizerFactory"/>
>    <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>     <analyzer type="query">
>    <tokenizer class="solr.StandardTokenizerFactory"/>
>    <filter class="solr.LowerCaseFilterFactory"/>
>     </analyzer>
>
> Any help on this would be appriciable.
>
> Thanks,
> Sandeep

Reply via email to