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 Mekin Maheshwari <me...@gmail.com> on 2007/05/14 13:11:32 UTC

NumberFormat exception when trying to use recip function query

Hi,

I am getting the following exception when I try & run any query :

java.lang.NumberFormatException: empty String
	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
	at java.lang.Float.parseFloat(Float.java:394)
	at org.apache.solr.search.QueryParsing$StrParser.getFloat(QueryParsing.java:478)
	at org.apache.solr.search.QueryParsing.parseValSource(QueryParsing.java:526)
	at org.apache.solr.search.QueryParsing.parseFunction(QueryParsing.java:579)
	at org.apache.solr.util.SolrPluginUtils.parseFuncs(SolrPluginUtils.java:519)
	at org.apache.solr.request.DisMaxRequestHandler.handleRequest(DisMaxRequestHandler.java:321)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:595)


The function query field is -
     <str name="bf">
        recip(popularityRank, 1, 1000,
1000)^0.5recip(rord(creationDate),1,1000,1000)^
0.3
     </str>

relevant field definitions from schema are:
   <field name="popularityRank" type="float" indexed="true" stored="true"
/>
   <field name="creationDate" type="date" indexed="true" stored="true"/>


I have checked that there is no document that has popularityRank as empty or
null.
(I ran an update query to set it to a large number when popularityRank was
empty or null)


If I change the function to rord(popularityRank) - the queries start working


Any clue what else I could do to debug this.

Thanks,
mekin

-- 
My company - http://ugenie.com
My Blog - http://mekin.livejournal.com/
My linkedin URL - http://www.linkedin.com/in/mekin

Re: NumberFormat exception when trying to use recip function query

Posted by Mekin Maheshwari <me...@gmail.com>.
Done.

Please check - http://wiki.apache.org/solr/FunctionQuery

and send me your comments (or improve the wiki )

Right now its more of a aggregation of all relevant information.
I hope people will be able to add notes like what values to use, pitfalls to
avoid, behaviour in special cases as well.

For example, I dont know how these functions deal with missing values.

-mekin


On 5/15/07, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> : The function query field is -
> :      <str name="bf">
> :         recip(popularityRank, 1, 1000,
> : 1000)^0.5recip(rord(creationDate),1,1000,1000)^
> : 0.3
> :      </str>
>
> off the top of my head, i'd suggest you:
>   1) verify there is some whitespace between the boost of the
> popularity recip function and the date recip function
>   2) eliminate the space inside the recip functions
>   3) verify that there isno psace between eitehr recp function and it's
> boost
>
> ...and see if that works...
>
>       <str name="bf">
>          recip(popularityRank,1,1000,1000)^0.5
>          recip(rord(creationDate),1,1000,1000)^0.3
>       </str>
>
>
>
> -Hoss
>
>


-- 
My company - http://ugenie.com
My Blog - http://mekin.livejournal.com/
My linkedin URL - http://www.linkedin.com/in/mekin

Re: NumberFormat exception when trying to use recip function query

Posted by Chris Hostetter <ho...@fucit.org>.
: The function query field is -
:      <str name="bf">
:         recip(popularityRank, 1, 1000,
: 1000)^0.5recip(rord(creationDate),1,1000,1000)^
: 0.3
:      </str>

off the top of my head, i'd suggest you:
  1) verify there is some whitespace between the boost of the
popularity recip function and the date recip function
  2) eliminate the space inside the recip functions
  3) verify that there isno psace between eitehr recp function and it's
boost

...and see if that works...

      <str name="bf">
         recip(popularityRank,1,1000,1000)^0.5
         recip(rord(creationDate),1,1000,1000)^0.3
      </str>



-Hoss