Minimum double score in a native script

Hi!,

I am writing a Java plugin with a customized score script (native)
returning a double. Basically I wrote a class extending
AbstractDoubleSearchScript.
For some documents which don't pass a specific test, the score should be
the lowest possible, meaning they should be at the bottom of the results.
Its is hard for me to find a lower bound for my scores, since they are
logarithms of probabilities. (the theoretical lower bound is log(0))
I have tried returning in the runAsDouble() method
Double.NEGATIVE_INFINITY and also
(-Double.MAX_VALUE)
since the Double.MIN_VALUE is not actualy the minimum negative value (I
guess the name of that constant is not consistent with the one for
Integer.MIN_VALUE but that's a different story).

When I return the aforementioned constants I get an error:
java.lang.IllegalArgumentException: docID must be >= 0 and <
maxDoc=58514550 (got docID=2147483647)
at
org.apache.lucene.index.BaseCompositeReader.readerIndex(BaseCompositeReader.java:182)
at
org.apache.lucene.index.BaseCompositeReader.document(BaseCompositeReader.java:109)
at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:196)
at
org.elasticsearch.search.fetch.FetchPhase.loadStoredFields(FetchPhase.java:228)
at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:156)
at
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:340)
at
org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:308)
at
org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:305)
at
org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

I am using ES 1.2.0 on a single machine. and the query is formed like this:

{
"query" : {
"function_score" : {
"query" : {
//some filters
},
"script_score" : {
"script" : "my_script",
"lang" : "native",
"params" : {
//some parameters
}
},
"score_mode" : "first",
"boost_mode" : "replace"
}
}
}

Cheers

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/67ebe35f-d58c-4890-aacb-b7647fcde75a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.