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 abhayd <aj...@hotmail.com> on 2012/08/11 07:42:01 UTC

how to boost exact match

hi 

I have documents like
iphone 4 - white
iphone 4s - black
ipone4 - black

when user searches for iphone 4 i would like to show iphone 4 docs first and
iphone 4s after that.
Similary when user is searching for iphone 4s i would like to show iphone 4s
docs first then iphone 4 docs.

At present i use whitespace tokenizer. Any idea how to achieve this?





--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to boost exact match

Posted by Karthick Duraisamy Soundararaj <ka...@gmail.com>.
Sorry about resending couple of times, I accidently hit send a couple of
times..

@ajdabholkar,  It certainly achievable. How exactly to achieve this depends
on your document structure.

Lets say you have
iphone 4 - white
iphone 4s - white
iphone 4 - black

case 1: You have product_name - color format
If you have a field in each of your documents that specifies product_name
and color delimited by -, in other words, if you know your documents have
product_name - color/attribute formate, then you could do
       1. copy the field to a new field, lets say ProductName ( This Field
should be of type string)
       2. Convert everything to lowerCaseFilterFactory & then use
PatternReplace filterfactory to replace everything thats after "-". So you
get the following.
               iphone 4
               iphone 4s
               iphone 4s
       3. Now boost on this new field, whenever there is a match. You bf
should be something like this
 bf=product_name^5.0

case 2: You have a field that just has product_name in it
If you have a field product_name, then just boost it directly by just
changing its field type to string.

On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj <
karthick.soundararaj@gmail.com> wrote:

> @ajdabholkar,  It certainly achievable. How exactly to achieve this
> depends on your document structure.
>
> Lets say you have
> iphone 4 - white
> iphone 4s - white
> iphone 4 - black
>
> case 1: You have product_name - color format
> If you have a field in each of your documents that specifies product_name
> and color delimited by -, in other words, if you know your documents have
> product_name - color/attribute formate, then you could do
>        1. copy the field to a new field, lets say ProductName ( This Field
> should be of type string)
>        2. Convert everything to lowerCaseFilterFactory & then use
> PatternReplace filterfactory to replace everything thats after "-". So you
> get the following.
>                iphone 4
>                iphone 4s
>                iphone 4s
>        3. Now boost on this new field, whenever there is a match. You bf
> should be something like this
>  bq=cat:electronics^5.0
> On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj <
> karthick.soundararaj@gmail.com> wrote:
>
>> @ajdabholkar,  It certainly achievable. How exactly to achieve this
>> depends on your document structure.
>>
>>  Lets say you have
>> iphone 4 - white
>> iphone 4s - white
>> iphone 4 - black
>>
>> case 1: You have product_name - color format
>> If you have a field in each of your documents that specifies product_name
>> and color delimited by -, in other words, if you know your documents have
>> product_name - color/attribute formate, then you could do
>>        1. copy the field to a new field, lets say ProductName ( This
>> Field should be of type string)
>>        2. Convert everything to lowerCaseFilterFactory & then use
>> PatternReplace filterfactory to replace everything thats after "-". So you
>> get the following.
>>                iphone 4
>>                iphone 4s
>>                iphone 4s
>>        3. Now boost on this new field, whenever there is a match. You bf
>> should be something like this
>>  bq=cat:electronics^5.0
>>
>>
>> bq=cat:electronics^5.0
>>
>>
>>
>> Do you have a product name field which says "iphone 4" and attribute
>> field which specfies the color?
>>
>>
>> On Sat, Aug 11, 2012 at 1:51 AM, Li Li <fa...@gmail.com> wrote:
>>
>>> create an field for exact match. it is a optional boolean clause
>>> 在 2012-8-11 下午1:42,"abhayd" <aj...@hotmail.com>写道:
>>>
>>> > hi
>>> >
>>> > I have documents like
>>> > iphone 4 - white
>>> > iphone 4s - black
>>> > ipone4 - black
>>> >
>>> > when user searches for iphone 4 i would like to show iphone 4 docs
>>> first
>>> > and
>>> > iphone 4s after that.
>>> > Similary when user is searching for iphone 4s i would like to show
>>> iphone
>>> > 4s
>>> > docs first then iphone 4 docs.
>>> >
>>> > At present i use whitespace tokenizer. Any idea how to achieve this?
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > View this message in context:
>>> >
>>> http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html
>>> > Sent from the Solr - User mailing list archive at Nabble.com.
>>> >
>>>
>>
>>
>>
>>
>>
>
>
>
>

Re: how to boost exact match

Posted by Karthick Duraisamy Soundararaj <ka...@gmail.com>.
@ajdabholkar,  It certainly achievable. How exactly to achieve this depends
on your document structure.

Lets say you have
iphone 4 - white
iphone 4s - white
iphone 4 - black

case 1: You have product_name - color format
If you have a field in each of your documents that specifies product_name
and color delimited by -, in other words, if you know your documents have
product_name - color/attribute formate, then you could do
       1. copy the field to a new field, lets say ProductName ( This Field
should be of type string)
       2. Convert everything to lowerCaseFilterFactory & then use
PatternReplace filterfactory to replace everything thats after "-". So you
get the following.
               iphone 4
               iphone 4s
               iphone 4s
       3. Now boost on this new field, whenever there is a match. You bf
should be something like this
 bq=cat:electronics^5.0
On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj <
karthick.soundararaj@gmail.com> wrote:

> @ajdabholkar,  It certainly achievable. How exactly to achieve this
> depends on your document structure.
>
> Lets say you have
> iphone 4 - white
> iphone 4s - white
> iphone 4 - black
>
> case 1: You have product_name - color format
> If you have a field in each of your documents that specifies product_name
> and color delimited by -, in other words, if you know your documents have
> product_name - color/attribute formate, then you could do
>        1. copy the field to a new field, lets say ProductName ( This Field
> should be of type string)
>        2. Convert everything to lowerCaseFilterFactory & then use
> PatternReplace filterfactory to replace everything thats after "-". So you
> get the following.
>                iphone 4
>                iphone 4s
>                iphone 4s
>        3. Now boost on this new field, whenever there is a match. You bf
> should be something like this
>  bq=cat:electronics^5.0
>
>
> bq=cat:electronics^5.0
>
>
>
> Do you have a product name field which says "iphone 4" and attribute field
> which specfies the color?
>
>
> On Sat, Aug 11, 2012 at 1:51 AM, Li Li <fa...@gmail.com> wrote:
>
>> create an field for exact match. it is a optional boolean clause
>> 在 2012-8-11 下午1:42,"abhayd" <aj...@hotmail.com>写道:
>>
>> > hi
>> >
>> > I have documents like
>> > iphone 4 - white
>> > iphone 4s - black
>> > ipone4 - black
>> >
>> > when user searches for iphone 4 i would like to show iphone 4 docs first
>> > and
>> > iphone 4s after that.
>> > Similary when user is searching for iphone 4s i would like to show
>> iphone
>> > 4s
>> > docs first then iphone 4 docs.
>> >
>> > At present i use whitespace tokenizer. Any idea how to achieve this?
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html
>> > Sent from the Solr - User mailing list archive at Nabble.com.
>> >
>>
>
>
>
> --
> --
> Karthick D S
> Master's in Computer Engineering ( Software Track )
> Syracuse University
> Syracuse - 13210
> New York
> United States of America
>
>


-- 
--
Karthick D S
Master's in Computer Engineering ( Software Track )
Syracuse University
Syracuse - 13210
New York
United States of America

Re: how to boost exact match

Posted by Karthick Duraisamy Soundararaj <ka...@gmail.com>.
@ajdabholkar,  It certainly achievable. How exactly to achieve this depends
on your document structure.

Lets say you have
iphone 4 - white
iphone 4s - white
iphone 4 - black

case 1: You have product_name - color format
If you have a field in each of your documents that specifies product_name
and color delimited by -, in other words, if you know your documents have
product_name - color/attribute formate, then you could do
       1. copy the field to a new field, lets say ProductName ( This Field
should be of type string)
       2. Convert everything to lowerCaseFilterFactory & then use
PatternReplace filterfactory to replace everything thats after "-". So you
get the following.
               iphone 4
               iphone 4s
               iphone 4s
       3. Now boost on this new field, whenever there is a match. You bf
should be something like this
 bq=cat:electronics^5.0


bq=cat:electronics^5.0



Do you have a product name field which says "iphone 4" and attribute field
which specfies the color?


On Sat, Aug 11, 2012 at 1:51 AM, Li Li <fa...@gmail.com> wrote:

> create an field for exact match. it is a optional boolean clause
> 在 2012-8-11 下午1:42,"abhayd" <aj...@hotmail.com>写道:
>
> > hi
> >
> > I have documents like
> > iphone 4 - white
> > iphone 4s - black
> > ipone4 - black
> >
> > when user searches for iphone 4 i would like to show iphone 4 docs first
> > and
> > iphone 4s after that.
> > Similary when user is searching for iphone 4s i would like to show iphone
> > 4s
> > docs first then iphone 4 docs.
> >
> > At present i use whitespace tokenizer. Any idea how to achieve this?
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>



-- 
--
Karthick D S
Master's in Computer Engineering ( Software Track )
Syracuse University
Syracuse - 13210
New York
United States of America

Re: how to boost exact match

Posted by Li Li <fa...@gmail.com>.
create an field for exact match. it is a optional boolean clause
在 2012-8-11 下午1:42,"abhayd" <aj...@hotmail.com>写道:

> hi
>
> I have documents like
> iphone 4 - white
> iphone 4s - black
> ipone4 - black
>
> when user searches for iphone 4 i would like to show iphone 4 docs first
> and
> iphone 4s after that.
> Similary when user is searching for iphone 4s i would like to show iphone
> 4s
> docs first then iphone 4 docs.
>
> At present i use whitespace tokenizer. Any idea how to achieve this?
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>