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 wuqi <ch...@gmail.com> on 2008/06/24 18:16:30 UTC
How about adding a new paramer to Similarity.scorePayload( ) ?
Hi,
I want to customize a new Similarity class which need to adopt payload information.The current definition of scorePayload is below:
"public float scorePayload(String fieldName, byte [] payload, int offset, int length)"
I have a problem when using this function.In case we have two BoostingTermQuery:
BoostingTermQuery #1: fieldName="Country" and fieldValue= "America"
BoostingTermQuery #2: fieldName="Country" and fieldValue="China"
and the the information of one payloads looks like this:
payload: {new York,san Jose,Chicago}
of course,query #1 should get a higher payPayload score.But current interface prevent us from sending fieldValue information to scorePayload function. So maybe we should add a new interface like
public float scorePayload(String fielName,String value,byte[] payload,int offset,int length)
and Boosting Query also need to be changed accordingly.
Thanks
-Qi
Re: How about adding a new paramer to Similarity.scorePayload( ) ?
Posted by Grant Ingersoll <gs...@apache.org>.
Not sure, but would a CustomScoreQuery (or an extension of it) work
for you? This way, you could try to combine the BoostingTermQuery
with a ValueSourceQuery (i.e. FunctionQuery)
Another option is to just extend BoostingTermQuery and implement your
own scorer that takes into account the field.
Of course, that isn't to say your idea is wrong. We could add the
method and add a new Payload Query that calls it, or just change it
all together. Of course, things may change, too, if and when we want
to do things like add payload phrase queries. A patch would be good.
Just trying to brainstorm some alternatives that don't involve API
changes.
On Jun 24, 2008, at 12:16 PM, wuqi wrote:
> Hi,
> I want to customize a new Similarity class which need to adopt
> payload information.The current definition of scorePayload is below:
> "public float scorePayload(String fieldName, byte [] payload, int
> offset, int length)"
> I have a problem when using this function.In case we have two
> BoostingTermQuery:
> BoostingTermQuery #1: fieldName="Country" and fieldValue=
> "America"
> BoostingTermQuery #2: fieldName="Country" and fieldValue="China"
> and the the information of one payloads looks like this:
> payload: {new York,san Jose,Chicago}
> of course,query #1 should get a higher payPayload score.But current
> interface prevent us from sending fieldValue information to
> scorePayload function. So maybe we should add a new interface like
> public float scorePayload(String fielName,String value,byte[]
> payload,int offset,int length)
> and Boosting Query also need to be changed accordingly.
>
> Thanks
> -Qi
>
>
>
--------------------------
Grant Ingersoll
http://www.lucidimagination.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