You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by zsl <za...@gmail.com> on 2010/03/22 17:32:03 UTC
Set IDF value manually on a search query
Hi all!
Im developing an aplication that uses Lucene and I´m trying to set the IDF
manually before I do query.
In other words ¿Is there a way to do a search query with an IDF value
provided by me?
If it is, let me know.
Thank you in advance.
--
View this message in context: http://old.nabble.com/Set-IDF-value-manually-on-a-search-query-tp27988911p27988911.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Set IDF value manually on a search query
Posted by zsl <za...@gmail.com>.
Thank you so much, gonna try both options. Im trying to find some Similarity
examples too.
Andrzej Bialecki wrote:
>
> On 2010-03-22 18:06, zsl wrote:
>>
>> I was thinking about that, but i dont know if it is the best option. Ty.
>
> There is a certain trick to do this with the current API (let's hope the
> new API is more .. flexible .. ? ;) )
>
> Implement a dummy Searcher that delegates most of its work to the real
> Searcher, except for docFreq(Term), where you return your arbitrary
> values. Then do Searcher.rewrite(Query) to expand the query, and then
> Query.weight(Searcher) to obtain a Weight - which uses your modified IDF.
>
> Finally, use this Weight to run a query against your real Searcher.
>
> You can see this approach implemented here:
>
> https://issues.apache.org/jira/browse/SOLR-1632
>
> though this contains some Solr-specific scaffolding, too.
>
>
> --
> Best regards,
> Andrzej Bialecki <><
> ___. ___ ___ ___ _ _ __________________________________
> [__ || __|__/|__||\/| Information Retrieval, Semantic Web
> ___|||__|| \| || | Embedded Unix, System Integration
> http://www.sigram.com Contact: info at sigram dot com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/Set-IDF-value-manually-on-a-search-query-tp27988911p27993221.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Set IDF value manually on a search query
Posted by Andrzej Bialecki <ab...@getopt.org>.
On 2010-03-22 18:06, zsl wrote:
>
> I was thinking about that, but i dont know if it is the best option. Ty.
There is a certain trick to do this with the current API (let's hope the
new API is more .. flexible .. ? ;) )
Implement a dummy Searcher that delegates most of its work to the real
Searcher, except for docFreq(Term), where you return your arbitrary
values. Then do Searcher.rewrite(Query) to expand the query, and then
Query.weight(Searcher) to obtain a Weight - which uses your modified IDF.
Finally, use this Weight to run a query against your real Searcher.
You can see this approach implemented here:
https://issues.apache.org/jira/browse/SOLR-1632
though this contains some Solr-specific scaffolding, too.
--
Best regards,
Andrzej Bialecki <><
___. ___ ___ ___ _ _ __________________________________
[__ || __|__/|__||\/| Information Retrieval, Semantic Web
___|||__|| \| || | Embedded Unix, System Integration
http://www.sigram.com Contact: info at sigram dot com
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Set IDF value manually on a search query
Posted by zsl <za...@gmail.com>.
I was thinking about that, but i dont know if it is the best option. Ty.
Michael McCandless-2 wrote:
>
> You can create your own Similarity implementation?
>
> Mike
>
> On Mon, Mar 22, 2010 at 12:32 PM, zsl <za...@gmail.com> wrote:
>>
>> Hi all!
>>
>> Im developing an aplication that uses Lucene and I´m trying to set the
>> IDF
>> manually before I do query.
>> In other words ¿Is there a way to do a search query with an IDF value
>> provided by me?
>>
>> If it is, let me know.
>>
>> Thank you in advance.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Set-IDF-value-manually-on-a-search-query-tp27988911p27988911.html
>> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/Set-IDF-value-manually-on-a-search-query-tp27988911p27989419.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Set IDF value manually on a search query
Posted by Michael McCandless <lu...@mikemccandless.com>.
You can create your own Similarity implementation?
Mike
On Mon, Mar 22, 2010 at 12:32 PM, zsl <za...@gmail.com> wrote:
>
> Hi all!
>
> Im developing an aplication that uses Lucene and I´m trying to set the IDF
> manually before I do query.
> In other words ¿Is there a way to do a search query with an IDF value
> provided by me?
>
> If it is, let me know.
>
> Thank you in advance.
>
> --
> View this message in context: http://old.nabble.com/Set-IDF-value-manually-on-a-search-query-tp27988911p27988911.html
> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org