I just realise that the code below is a dirty hack :) but it does solve
the problem for me because in my case String param is always null.
I haven't been able to figure out what the purpose of fpname() is
because it seems that where it's used it is alwayse used to get values
from SolrParams never used to set them.
Thijs
Thijs schreef:
I'm running into a problem where the calls to SolrQuery.getStart(),
SolrQuery.getRows() always return null
I'm using trunk of 1.3
I think I also found the problem.
If I use SolrQuery.setRows(20), the value is set in the LinkedHashMap
with the key-values {"rows", {"20"}} in method set() (line 66 in
ModifiableSolrParams)
However when I use SolrQuery.getRows(), the values are retrieved
through SolrParams.getIntField("rows", null) -->
SolrParams.getFieldParam. This method first calls method
fpname("rows", null) which returns "f.rows.null" and that value is
used as key in ModifiableSolrParams to get the value from the
LinkedHashMap. This of course will return nothing because that key is
not in the hashmap.
So if I change methode fpname in SolrParams to
protected String fpname(String field, String param) {
return "field+(param==null?"":param);
// return "f."+field+'.'+param;
}
it works and getStart en getRows returns the values previously set.
I'm not sure this is the correct solution, could someone have a look
and if ok, commit it to the codebase?
Thanks
Thijs