Got it! Just for you to share ... and maybe for inclusion in the Java
API docs of ValueSource :)

For sorting one needs to implement the method

public double doubleVal(int) of the class ValueSource

then it works like a charm.

cheers,
  Mathias

On Tue, Sep 17, 2013 at 6:28 PM, Chris Hostetter
<hossman_luc...@fucit.org> wrote:
>
> : It basically allows for searching for text (which is associated to an
> : image) in an index and then getting the distance to a sample image
> : (base64 encoded byte[] array) based on one of five different low level
> : content based features stored as DocValues.
>
> very cool.
>
> : So there one little tiny question I still have ;) When I'm trying to
> : do a "sort" I'm getting
> :
> : "msg": "sort param could not be parsed as a query, and is not a field
> : that exists in the index:
> : lirefunc(cl_hi,FQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA=)",
> :
> : for the call 
> http://localhost:9000/solr/lire/select?q=*%3A*&sort=lirefunc(cl_hi%2CFQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA%3D)+asc&fl=id%2Ctitle%2Clirefunc(cl_hi%2CFQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA%3D)&wt=json&indent=true
>
> Hmmm...
>
> i think the crux of the issue is your string literal.  function parsing
> tries to make live easy for you by not requiring string literals to be
> quoted unless they conflict with other function names or field names
> etc....  on top of that the sort parsing code is kind of hueristic based
> (because it has to account for both functions or field names or wildcards,
> followed by other sort clauses, etc...) so in that context the special
> characters like '=' in your base64 string literal might be confusing hte
> hueristics.
>
> can you try to quote the string literal it and see if that works?
>
> For example, when i try using strdist with your base64 string in a sort
> param using the example configs i get the same error...
>
> http://localhost:8983/solr/select?q=*:*&sort=strdist%28name,FQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA=,jw%29+asc
>
> but if i quote the string literal it works fine...
>
> http://localhost:8983/solr/select?q=*:*&sort=strdist%28name,%27FQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA=%27,jw%29+asc
>
>
>
> -Hoss



-- 
Dr. Mathias Lux
Assistant Professor, Klagenfurt University, Austria
http://tinyurl.com/mlux-itec

Reply via email to