I'm running into some issues developing a custom functionquery.

My goal is to be able to implement a custom sorting technique.

I have a field defined called resname, it is a single value str.

Example: <str name="resname">/some
example/data/here/2013/09/12/testing.text</str>

I would like to do a custom sort based on this resname field.
Basically, I would like to parse out that date there (2013/09/12) and sort
on that date.


I've followed various tutorials
   - http://java.dzone.com/news/how-write-custom-solr
   -
http://www.supermind.org/blog/756/how-to-write-a-custom-solr-functionquery


Im at the point where my code compiles, runs, executes, etc. Solr is happy
with my code.

I have classes that inherit from ValueSorceParser and ValueSorce, etc. I've
overrode parse and
instantiated my class with ValueSource

public ValueSource parse(FunctionQParser fqp) {
    return MyCustomClass(fqp.parseValueSource)
}

public class MyCustomClass extends ValueSource {
    ValueSource source;

    public MyCustomClass(ValueSource source) {
        this.source = source;
    }

    public FunctionValues getValues(....) {
       final FunctionValues sourceDV =
source.getvalues(context,readerContext)
       return new IntValues(this)
            public int intVal(int doc) {
                //parse the value of "resname" here
                  String value = sourceDV.strVal(doc);
             ...more stuff
             }
       }
   }

The issue I'm running into is that my call to sourceDV.strVal(doc) only
returns "part" of the field, not all of it. It appears to be very random.

I guess my actual question is, how do I access / reference the EXACT RAW
value of a field, while writing a functionquery.

Do I need to change my ValueSource to a String?, then somehow lookup the
field name while inside my getValues call?

Is there a way to access the raw field data , when referencing it as a
FunctionValues?


Maybe I'm going about this totally incorrectly?

Reply via email to