recip(myfield,m,a,b)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

recip(myfield,m,a,b)

sunnyShiny06
Hi,

Is there a way to convert to integer to check if a = b ... like recip(myfield,m,language,lang)
But I would like to boost(scoring) field which have the same user language and book language ...

But for that I need to know convert.int(language)

Thanks,

Johanna
Reply | Threaded
Open this post in threaded view
|

Re: recip(myfield,m,a,b)

hossman

: Is there a way to convert to integer to check if a = b ... like
: recip(myfield,m,language,lang)
: But I would like to boost(scoring) field which have the same user language
: and book language ...
:
: But for that I need to know convert.int(language)

There is an OrdFieldSource that can be used with single-valued string
fields to get a
numeric value for where they are in the "order" of all values for that
field ... it is in fact what get's use by default when you include a
string fieldname in the functionquery syntax.

But off the top of my head i don't think there are any Functions provided
by default that let you compare two ValueSources and return one number if
they are equal and another number if they aren't.

Frankly: the best way to approach a problem like this is to set a boolean
field at index time if the other two fields are the same.


-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: recip(myfield,m,a,b)

sunnyShiny06
I don't think it can works at the index time, because I when somebody look for a book I want to boost the search in relation with the user language ...so I don"t think it can works, except if I didn't get it.

Thanks for your answer,

hossman wrote
: Is there a way to convert to integer to check if a = b ... like
: recip(myfield,m,language,lang)
: But I would like to boost(scoring) field which have the same user language
: and book language ...
:
: But for that I need to know convert.int(language)

There is an OrdFieldSource that can be used with single-valued string
fields to get a
numeric value for where they are in the "order" of all values for that
field ... it is in fact what get's use by default when you include a
string fieldname in the functionquery syntax.

But off the top of my head i don't think there are any Functions provided
by default that let you compare two ValueSources and return one number if
they are equal and another number if they aren't.

Frankly: the best way to approach a problem like this is to set a boolean
field at index time if the other two fields are the same.


-Hoss
Reply | Threaded
Open this post in threaded view
|

Re: recip(myfield,m,a,b)

hossman

: I don't think it can works at the index time, because I when somebody look
: for a book I want to boost the search in relation with the user language
: ...so I don"t think it can works, except if I didn't get it.

Hmmm... i clearly missunderstod what you were asking, you made it sound
like you wnated to boost the score of documents where the string value of
one field was the same as the string value of another field.

If you goal is to boost the score of documents where one field contains a
specific string specified by the user (ie: language) i'm not sure why you
are looking at using functionqueries (and the function syntax) at all ...
just add an optional "language:english" clause to your query.

if you are using the dismax parser, you can do this withteh "bq" param




-Hoss