You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by JensBurkhardt <je...@web.de> on 2008/02/20 17:30:49 UTC

Boost Single Values in Field

Hey,

I'm wondering if you can boost single values and not the whole field.
For example:
i'm having a field called test with "value1 value2 value3" - all packed in a
String - and
i want to boost specific values e.g value1^0.5 value2^1.5 etc.
The problem is that i can't seperate this field. I don't think this will
work but maybe someone has had the 
same problem.
Trying to search took me nowhere :-) so i decided to just ask and maybe i'm
lucky.

Greetings
Jens
-- 
View this message in context: http://www.nabble.com/Boost-Single-Values-in-Field-tp15591373p15591373.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Boost Single Values in Field

Posted by JensBurkhardt <je...@web.de>.
Okay, Thanks a lot for answering my questions. I'll give the split string
thing a try :-) .

Best Regards

Jens Burkhardt



Grant Ingersoll-6 wrote:
> 
> 
> On Feb 21, 2008, at 6:53 AM, JensBurkhardt wrote:
>>
>> Hello again,
>>
>> Thanks for your immediate response. As i understand, the only way to  
>> boost
>> the values is on query side, right?
>> The Problem is, that i need to boost field values. Okay, some more  
>> details:
>> I need it for a library. The string in the field i'm working with is
>> something like "Title author year_of_publication some_catchwords"  
>> and so on.
>> It's like on big String.
>> This field is called "Free-Text" so the query can something like  
>> "author AND
>> title".
>> And that's the point, the order of the search terms is arbitrary so  
>> i don't
>> know what i do boost in the field. If i want to boost the title i  
>> need to
>> boost the specific value in the Free-Text field.
>> If I'm wrong and i can handle this problem with using payload, could  
>> someone
>> please explain it cause i don't understand how to use payload on  
>> index side.
>>
> 
> I would split the string (either ahead of time or by writing your own  
> TeeTokenFilter and SinkTokenizer) such that you can separate out your  
> one big String into two smaller fields.  Other option, is to use  
> payloads
> 
> Token.setPayload() is how you set payloads.  There are a couple  
> examples in 2.3 in the contrib/analysis package of how to add payloads  
> for specific things, you would just need your own that recognized your  
> structure.
> 
> Also have a look at Michael B's excellent ApacheCon slides:
> http://people.apache.org/~buschmi/apachecon/AdvancedIndexingLuceneAtlanta07.ppt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Boost-Single-Values-in-Field-tp15591373p15634202.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Boost Single Values in Field

Posted by Grant Ingersoll <gs...@apache.org>.
On Feb 21, 2008, at 6:53 AM, JensBurkhardt wrote:
>
> Hello again,
>
> Thanks for your immediate response. As i understand, the only way to  
> boost
> the values is on query side, right?
> The Problem is, that i need to boost field values. Okay, some more  
> details:
> I need it for a library. The string in the field i'm working with is
> something like "Title author year_of_publication some_catchwords"  
> and so on.
> It's like on big String.
> This field is called "Free-Text" so the query can something like  
> "author AND
> title".
> And that's the point, the order of the search terms is arbitrary so  
> i don't
> know what i do boost in the field. If i want to boost the title i  
> need to
> boost the specific value in the Free-Text field.
> If I'm wrong and i can handle this problem with using payload, could  
> someone
> please explain it cause i don't understand how to use payload on  
> index side.
>

I would split the string (either ahead of time or by writing your own  
TeeTokenFilter and SinkTokenizer) such that you can separate out your  
one big String into two smaller fields.  Other option, is to use  
payloads

Token.setPayload() is how you set payloads.  There are a couple  
examples in 2.3 in the contrib/analysis package of how to add payloads  
for specific things, you would just need your own that recognized your  
structure.

Also have a look at Michael B's excellent ApacheCon slides: http://people.apache.org/~buschmi/apachecon/AdvancedIndexingLuceneAtlanta07.ppt

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Boost Single Values in Field

Posted by JensBurkhardt <je...@web.de>.

Grant Ingersoll-6 wrote:
> 
> You have two options:
> 
> 1. Boost the term on the query side.  The query parser pretty much  
> takes exactly the syntax you use.
> 2. Use Payloads along with the BoostingTermQuery.
> 
> Search the archives for info on one or both.
> 
> -Grant
> 
> On Feb 20, 2008, at 11:30 AM, JensBurkhardt wrote:
> 
>>
>> Hey,
>>
>> I'm wondering if you can boost single values and not the whole field.
>> For example:
>> i'm having a field called test with "value1 value2 value3" - all  
>> packed in a
>> String - and
>> i want to boost specific values e.g value1^0.5 value2^1.5 etc.
>> The problem is that i can't seperate this field. I don't think this  
>> will
>> work but maybe someone has had the
>> same problem.
>> Trying to search took me nowhere :-) so i decided to just ask and  
>> maybe i'm
>> lucky.
>>
>> Greetings
>> Jens
>> -- 
>> View this message in context:
>> http://www.nabble.com/Boost-Single-Values-in-Field-tp15591373p15591373.html
>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
> 
> 
> 
> 
> --------------------------
> Grant Ingersoll
> http://lucene.grantingersoll.com
> http://www.lucenebootcamp.com
> 
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

Hello again,

Thanks for your immediate response. As i understand, the only way to boost
the values is on query side, right?
The Problem is, that i need to boost field values. Okay, some more details:
I need it for a library. The string in the field i'm working with is
something like "Title author year_of_publication some_catchwords" and so on.
It's like on big String.
This field is called "Free-Text" so the query can something like "author AND
title".
And that's the point, the order of the search terms is arbitrary so i don't
know what i do boost in the field. If i want to boost the title i need to
boost the specific value in the Free-Text field.
If I'm wrong and i can handle this problem with using payload, could someone
please explain it cause i don't understand how to use payload on index side.

Best regards
Jens
-- 
View this message in context: http://www.nabble.com/Boost-Single-Values-in-Field-tp15591373p15608110.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Boost Single Values in Field

Posted by Grant Ingersoll <gs...@apache.org>.
You have two options:

1. Boost the term on the query side.  The query parser pretty much  
takes exactly the syntax you use.
2. Use Payloads along with the BoostingTermQuery.

Search the archives for info on one or both.

-Grant

On Feb 20, 2008, at 11:30 AM, JensBurkhardt wrote:

>
> Hey,
>
> I'm wondering if you can boost single values and not the whole field.
> For example:
> i'm having a field called test with "value1 value2 value3" - all  
> packed in a
> String - and
> i want to boost specific values e.g value1^0.5 value2^1.5 etc.
> The problem is that i can't seperate this field. I don't think this  
> will
> work but maybe someone has had the
> same problem.
> Trying to search took me nowhere :-) so i decided to just ask and  
> maybe i'm
> lucky.
>
> Greetings
> Jens
> -- 
> View this message in context: http://www.nabble.com/Boost-Single-Values-in-Field-tp15591373p15591373.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>




--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com
http://www.lucenebootcamp.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ





---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org