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 JACK <mf...@gmail.com> on 2015/06/12 11:38:10 UTC

Solr Exact match boost Reduce the results

I have two fields, one is copy field. I have to get Exact match results first
along with entire result of fuzzy search.

    <field name="product_name" type="text_wslc" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="dummy_name" type="string_ci" indexed="true" stored="false"
required="true" />
<copyField source="product_name" dest="dummy_name"/>

Its filed definition is given below

<fieldType name="text_wslc" class="solr.TextField"
positionIncrementGap="100">
                        <analyzer type="index">
                                  <tokenizer
class="solr.WhitespaceTokenizerFactory"/>
        			<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
       				<filter class="solr.WordDelimiterFilterFactory"
               				 generateWordParts="1"
               				 generateNumberParts="1"
               				 catenateWords="1"
                			 catenateNumbers="1"
                			 catenateAll="1"
               				 preserveOriginal="1"
               				 />
				<filter class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.SnowballPorterFilterFactory" language="English" />
				<filter class="solr.PorterStemFilterFactory"/>
				<filter class="solr.KStemFilterFactory"/>
				<filter class="solr.EnglishMinimalStemFilterFactory"/>
                        </analyzer>
                        <analyzer type="query">
                                <tokenizer
class="solr.WhitespaceTokenizerFactory"/>
				<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
       				<filter class="solr.WordDelimiterFilterFactory"
               				 generateWordParts="1"
               				 generateNumberParts="1"
               				 catenateWords="1"
                			 catenateNumbers="1"
                			 catenateAll="1"
               				 preserveOriginal="1"
               				 />
                                <filter
class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.SnowballPorterFilterFactory" language="English" />
				<filter class="solr.PorterStemFilterFactory"/>
				<filter class="solr.KStemFilterFactory"/>
				<filter class="solr.EnglishMinimalStemFilterFactory"/>
                        </analyzer>
 </fieldType>

<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true"
omitNorms="true">
		      <analyzer type="index">
   			<tokenizer class="solr.WhitespaceTokenizerFactory"/>
  			<filter class="solr.LimitTokenCountFilterFactory" maxTokenCount="20"/>
   			<filter class="solr.LowerCaseFilterFactory"/>
		     </analyzer>
		     <analyzer type="query">
                        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
                        <filter class="solr.LimitTokenCountFilterFactory"
maxTokenCount="20"/>
                        <filter class="solr.LowerCaseFilterFactory"/>
                        <filter class="solr.SnowballPorterFilterFactory"
language="English" />
			<filter class="solr.KStemFilterFactory"/>
			<filter class="solr.EnglishMinimalStemFilterFactory"/>
                   </analyzer>
</fieldType>

The dummy filed is to get the exact match results.
1. To get exact results first just use quotes around the search words. So i
am getting the exact results first. But the result is too less.Around
8000.Query is given below
q="laptop+bag"&df=product_name&defType=edismax&qf=product_name^0.01+dummy_name^200

2. But for the query without quotes gives huge amount of results around
20000, but won't give exact one first. Its query is below
q=laptop+bag&df=product_name&defType=edismax&qf=product_name^0.01+dummy_name^200

I have to get huge results like my second option with exact results first.
Is this the way to do it or any problem in my query?



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
I did a simple test using out of the Box Edismax ( not even configuring
specific params or the phrase field).
As expected the exact match comes first.
This is because of the norms and the natural way the Edismax boost exact
matches.

Are you sure you are using a proper query parser ?
I did nothing analysis side, I simply used a standard field.
Also I find a little bit suspicious your double field analysis approach and
the field boost.
Are you sure it's not related to the synonyms ?

Cheers


2015-06-12 16:27 GMT+01:00 JACK <mf...@gmail.com>:

> The quoted search words will be different and it will be any word or more
> than one word. In the query it's just example
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211410.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
The quoted search words will be different and it will be any word or more
than one word. In the query it's just example 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211410.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi, I have to search on the field product_name.It is found that in order to
get exact matches first, I made one copy field named as dummy_name with the
above field definition.And while query, just boost the copy field. I done
this. So as to get exact matches I need to put quotes around the search
words. When I do this my results is too less compared to search without
quotes. But I need the same results without quotes along with exact matches
should come first



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211409.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
Are we talking about a title field ?
Querying only that title field ?
And the texts you put are the titles ?

If this is the case and you are not omitting norms ( because norms boost
short field containing the query terms).
The second results should be the ones expected.

Can you describe a little bit more ? DO the field you are querying contain
actually more text and not only the one you quoted ?

Cheers

2015-06-12 14:25 GMT+01:00 JACK <mf...@gmail.com>:

> Hi Alessandro Benedetti ,
>
> What i meant is that suppose if i have items like this
>
> dell laptop with bag
> dell laptop
> dell laptop without bag
> dell inspiron laptop with bag
> if i query for "dell laptop", the result should be like this
> dell laptop
> dell laptop with bag
> dell laptop without bag
> dell inspiron laptop with bag
> Exact match should come first, rest of the things will be in the any order,
> but should get the same number of results
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211377.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi Alessandro Benedetti ,

What i meant is that suppose if i have items like this

dell laptop with bag
dell laptop
dell laptop without bag
dell inspiron laptop with bag
if i query for "dell laptop", the result should be like this
dell laptop
dell laptop with bag
dell laptop without bag
dell inspiron laptop with bag
Exact match should come first, rest of the things will be in the any order,
but should get the same number of results




--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211377.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi  Alessandro Benedetti,
Can you check what happens to the below given product_name , just check its
score 

"product_name":"LAPTOP BATTERY DELL Inspiron 6400 1501 E1505 RD859 UD267
XU937"
How is this product comes , ?



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4213417.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
Hi Jack,

2015-06-23 6:27 GMT+01:00 JACK <mf...@gmail.com>:

> Hi  Alessandro Benedetti,
>
> I have changed the query like this.
>
>
> /select?q=("dell+laptop"~13+OR+"dell+laptop")&df=product_name&defType=edismax&qf=product_name^0.001+dummy_product_name^20000&fl=product_name&wt=json&indent=true&debug=true
>

Pardon me, but I find this query awful. In my opinion is not necessary at
all.
I can't take a deep look to your debug right now, but I suggest you to use
this free tool ( http://splainer.io ) to read it easily .
 My suggestions remain :

1) carefully take care of your analysis
2) carefully take care of the schema ( field attributes)
3) carefully take care of the handler config

Cheers

>
> The corresponding results also given in the below link.Now am getting exact
> match first.
>
> http://pastebin.com/rAYrFiB8
>
>
> Now the problem is Look at the 8th result
> "product_name":"Dell Inspiron 15R 15.6-inch Laptop without Laptop Bag by
> Dell", its not a relevant result
> can you check How this happens , check the scores.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4213382.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi  Alessandro Benedetti,

I have changed the query like this.

/select?q=("dell+laptop"~13+OR+"dell+laptop")&df=product_name&defType=edismax&qf=product_name^0.001+dummy_product_name^20000&fl=product_name&wt=json&indent=true&debug=true

The corresponding results also given in the below link.Now am getting exact
match first.

http://pastebin.com/rAYrFiB8


Now the problem is Look at the 8th result 
"product_name":"Dell Inspiron 15R 15.6-inch Laptop without Laptop Bag by
Dell", its not a relevant result
can you check How this happens , check the scores. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4213382.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
Your posted terms doesn't make a lot of sense …
I simply indexed your content in a text_general field.
Without omitting norms or applying any deep analysis.
And I got the expected results.

You should use the analysis tool with your different inputs, taking a look
to the token stream produced.
Maybe a screenshot will be more readable.

Cheers

2015-06-15 13:18 GMT+01:00 JACK <mf...@gmail.com>:

> Hi  Alessandro Benedetti,
> Its my Analysis value index
>
>
> WT
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> 2
> SF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> 2
> WDF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> 2
> LCF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> 2
> SF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> keyword
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> false
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> false
> 2
> PSF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> keyword
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> false
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> false
> 2
> KSF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> keyword
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> false
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> false
> 2
> EMSF
>
> text
> raw_bytes
> start
> end
> positionLength
> type
> keyword
> position
>
> laptop
> [6c 61 70 74 6f 70]
> 0
> 6
> 1
> word
> false
> 1
>
> bag
> [62 61 67]
> 7
> 10
> 1
> word
> false
> 2
>
> How do you get the result i can't understand
> Can you help?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211845.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi  Alessandro Benedetti,
Its my Analysis value index


WT
	
text
raw_bytes
start
end
positionLength
type
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
1
	
bag
[62 61 67]
7
10
1
word
2
SF
	
text
raw_bytes
start
end
positionLength
type
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
1
	
bag
[62 61 67]
7
10
1
word
2
WDF
	
text
raw_bytes
start
end
positionLength
type
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
1
	
bag
[62 61 67]
7
10
1
word
2
LCF
	
text
raw_bytes
start
end
positionLength
type
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
1
	
bag
[62 61 67]
7
10
1
word
2
SF
	
text
raw_bytes
start
end
positionLength
type
keyword
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
false
1
	
bag
[62 61 67]
7
10
1
word
false
2
PSF
	
text
raw_bytes
start
end
positionLength
type
keyword
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
false
1
	
bag
[62 61 67]
7
10
1
word
false
2
KSF
	
text
raw_bytes
start
end
positionLength
type
keyword
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
false
1
	
bag
[62 61 67]
7
10
1
word
false
2
EMSF
	
text
raw_bytes
start
end
positionLength
type
keyword
position
	
laptop
[6c 61 70 74 6f 70]
0
6
1
word
false
1
	
bag
[62 61 67]
7
10
1
word
false
2

How do you get the result i can't understand 
Can you help?



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211845.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
Using your same data I get the expected ranking and not yours.
I am using a simple analysis so I would invite you to analyse the analysis
chain in first instance.
as a second suggestion, are you omitting or not omitting norms ?
By default they should not be omitted.

2015-06-15 11:13 GMT+01:00 JACK <mf...@gmail.com>:

> Hi  Alessandro Benedetti,
> The query is
>
> http://localhost:8983/solr/MYDBCORE/select?q=product_name:(laptop+bag)&wt=json&indent=true
>
> 1.Dell Inspiron 3542 Laptop (Black) without Laptop Bag
> 2.Dell 3542 15-inch Laptop with Laptop Bag by Dell
> 3.Dell Inspiron N3137 11-inch Laptop without Laptop Bag by Dell
> 4.Dell Inspiron 3442 14-Inch Laptop (Black) without Laptop Bag by Dell
> 5.Dell Inspiron 3442  Black 14 inch Laptop Without Laptop Bag by Dell
> 6.Dell Alienware 13-inch Laptop without Laptop Bag by Dell
> 7.Dell Vostro 3546 Laptop without Laptop Bag by Dell
> 8.Laptop - BAG
> 9.Laptop -BAG
> 10.Laptop-BAG
>
> I need to get Last three results first, rest of the results can be any
> order
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211826.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi  Alessandro Benedetti,
The query is 
http://localhost:8983/solr/MYDBCORE/select?q=product_name:(laptop+bag)&wt=json&indent=true

1.Dell Inspiron 3542 Laptop (Black) without Laptop Bag
2.Dell 3542 15-inch Laptop with Laptop Bag by Dell
3.Dell Inspiron N3137 11-inch Laptop without Laptop Bag by Dell
4.Dell Inspiron 3442 14-Inch Laptop (Black) without Laptop Bag by Dell
5.Dell Inspiron 3442  Black 14 inch Laptop Without Laptop Bag by Dell
6.Dell Alienware 13-inch Laptop without Laptop Bag by Dell
7.Dell Vostro 3546 Laptop without Laptop Bag by Dell
8.Laptop - BAG
9.Laptop -BAG
10.Laptop-BAG

I need to get Last three results first, rest of the results can be any order



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211826.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
I read you are using a really deep analysed field type.
Let's forget about the dummy copy field.
Can you show me based on your main field, an example of query, and an
example of first 20 results ?
Showing me the ranking you get and the ranking you expect ?

Cheers

2015-06-15 10:39 GMT+01:00 Alessandro Benedetti <be...@gmail.com>
:

>
>
> 2015-06-12 17:53 GMT+01:00 JACK <mf...@gmail.com>:
>
>> As explained above, actually I have around 10 lack data not 5 row.
>
> This is not changing how the edismax and norms in Solr work. So it's not a
> point.
>
>
>> It's not
>> about synonyms . When I checked in the FAQ page of Solr wiki, it is found
>> that if we need to get exact match results first, use a copy field with
>> different configuration. That's why I followed this way.
>>
>
> Can you show me this link, as I still find difficult to understand why you
> are getting this not by default.
> Have you tried the Analysis tool to verify which kind of terms you are
> actually indexing ?
> I will take a look better to you analysis configuration.
> Before accusing Solr relevancy we should be sure what we index and what we
> query ( after the analysis chain)
>
> Cheers
>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211434.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
2015-06-12 17:53 GMT+01:00 JACK <mf...@gmail.com>:

> As explained above, actually I have around 10 lack data not 5 row.

This is not changing how the edismax and norms in Solr work. So it's not a
point.


> It's not
> about synonyms . When I checked in the FAQ page of Solr wiki, it is found
> that if we need to get exact match results first, use a copy field with
> different configuration. That's why I followed this way.
>

Can you show me this link, as I still find difficult to understand why you
are getting this not by default.
Have you tried the Analysis tool to verify which kind of terms you are
actually indexing ?
I will take a look better to you analysis configuration.
Before accusing Solr relevancy we should be sure what we index and what we
query ( after the analysis chain)

Cheers

>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211434.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

RE: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
Hi chillra,
I have changed the index and query filed configuration to

 <tokenizer class="solr.KeywordTokenizerFactory"/>
  <filter class="solr.LowerCaseFilterFactory"/>

But still my problem not solved , it won't resolve my problem.



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211788.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Solr Exact match boost Reduce the results

Posted by Andrew Chillrud <ac...@opentext.com>.
If I understand you correctly you want to boost the score of documents where the contents of the product_name field match exactly (other than case) the query string.

I think what you need is for the dummy_name field to be non-tokenized (indexed as a single string rather than parsed into individual words). The name of the field type you have configured the dummy_name field  to use (string_ci) would seem to indicate this is your intent. However the definition of string_ci doesn't match the name. It is configured to use the WhitespaceTokenizerFactory tokenizer, which will break the contents of the field up into multiple tokens where ever white space occurs.

Try defining string_ci using the (somewhat cryptically named) KeywordTokenizerFactory, which will index the entire contents of the field as a single token. Something like:

    <fieldType name="string_ci" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr. LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

- Andy -

-----Original Message-----
From: JACK [mailto:mfalakh@gmail.com] 
Sent: Friday, June 12, 2015 12:54 PM
To: solr-user@lucene.apache.org
Subject: Re: Solr Exact match boost Reduce the results

As explained above, actually I have around 10 lack data not 5 row. It's not about synonyms . When I checked in the FAQ page of Solr wiki, it is found that if we need to get exact match results first, use a copy field with different configuration. That's why I followed this way. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211434.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by JACK <mf...@gmail.com>.
As explained above, actually I have around 10 lack data not 5 row. It's not
about synonyms . When I checked in the FAQ page of Solr wiki, it is found
that if we need to get exact match results first, use a copy field with
different configuration. That's why I followed this way. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352p4211434.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Exact match boost Reduce the results

Posted by Alessandro Benedetti <be...@gmail.com>.
Hi jack, do you mean exact match over the synonyms ?
In that case, with your Analyzer you are not going to be able to see that.
You apply index analysis synonym expansion.
So for your Index there is no difference between the synonyms, there is no
"exact match" .

In this case I would suggest you to use a custom Synonym query parser that
actually solve this problem boosting original terms and providing nice
query time synonyms :

http://nolanlawson.com/2012/10/31/better-synonym-handling-in-solr/

If it's not related the synonyms, you should take a look to the edismax
query parser.
I think he enhance exact phrase matches out of the box.

Cheers



2015-06-12 10:38 GMT+01:00 JACK <mf...@gmail.com>:

> I have two fields, one is copy field. I have to get Exact match results
> first
> along with entire result of fuzzy search.
>
>     <field name="product_name" type="text_wslc" indexed="true"
> stored="true"
> required="true" multiValued="false"/>
> <field name="dummy_name" type="string_ci" indexed="true" stored="false"
> required="true" />
> <copyField source="product_name" dest="dummy_name"/>
>
> Its filed definition is given below
>
> <fieldType name="text_wslc" class="solr.TextField"
> positionIncrementGap="100">
>                         <analyzer type="index">
>                                   <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>                                 <filter class="solr.SynonymFilterFactory"
> synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>                                 <filter
> class="solr.WordDelimiterFilterFactory"
>                                          generateWordParts="1"
>                                          generateNumberParts="1"
>                                          catenateWords="1"
>                                          catenateNumbers="1"
>                                          catenateAll="1"
>                                          preserveOriginal="1"
>                                          />
>                                 <filter
> class="solr.LowerCaseFilterFactory"/>
>                                 <filter
> class="solr.SnowballPorterFilterFactory" language="English" />
>                                 <filter
> class="solr.PorterStemFilterFactory"/>
>                                 <filter class="solr.KStemFilterFactory"/>
>                                 <filter
> class="solr.EnglishMinimalStemFilterFactory"/>
>                         </analyzer>
>                         <analyzer type="query">
>                                 <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>                                 <filter class="solr.SynonymFilterFactory"
> synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>                                 <filter
> class="solr.WordDelimiterFilterFactory"
>                                          generateWordParts="1"
>                                          generateNumberParts="1"
>                                          catenateWords="1"
>                                          catenateNumbers="1"
>                                          catenateAll="1"
>                                          preserveOriginal="1"
>                                          />
>                                 <filter
> class="solr.LowerCaseFilterFactory"/>
>                                 <filter
> class="solr.SnowballPorterFilterFactory" language="English" />
>                                 <filter
> class="solr.PorterStemFilterFactory"/>
>                                 <filter class="solr.KStemFilterFactory"/>
>                                 <filter
> class="solr.EnglishMinimalStemFilterFactory"/>
>                         </analyzer>
>  </fieldType>
>
> <fieldType name="string_ci" class="solr.TextField" sortMissingLast="true"
> omitNorms="true">
>                       <analyzer type="index">
>                         <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>                         <filter class="solr.LimitTokenCountFilterFactory"
> maxTokenCount="20"/>
>                         <filter class="solr.LowerCaseFilterFactory"/>
>                      </analyzer>
>                      <analyzer type="query">
>                         <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>                         <filter class="solr.LimitTokenCountFilterFactory"
> maxTokenCount="20"/>
>                         <filter class="solr.LowerCaseFilterFactory"/>
>                         <filter class="solr.SnowballPorterFilterFactory"
> language="English" />
>                         <filter class="solr.KStemFilterFactory"/>
>                         <filter
> class="solr.EnglishMinimalStemFilterFactory"/>
>                    </analyzer>
> </fieldType>
>
> The dummy filed is to get the exact match results.
> 1. To get exact results first just use quotes around the search words. So i
> am getting the exact results first. But the result is too less.Around
> 8000.Query is given below
>
> q="laptop+bag"&df=product_name&defType=edismax&qf=product_name^0.01+dummy_name^200
>
> 2. But for the query without quotes gives huge amount of results around
> 20000, but won't give exact one first. Its query is below
>
> q=laptop+bag&df=product_name&defType=edismax&qf=product_name^0.01+dummy_name^200
>
> I have to get huge results like my second option with exact results first.
> Is this the way to do it or any problem in my query?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Exact-match-boost-Reduce-the-results-tp4211352.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England