Skip to content

Instantly share code, notes, and snippets.

@chaitanyamannem
Created May 11, 2016 07:30
Show Gist options
  • Save chaitanyamannem/c366bbaae3fca7805fdcb5ea0f0b491f to your computer and use it in GitHub Desktop.
Save chaitanyamannem/c366bbaae3fca7805fdcb5ea0f0b491f to your computer and use it in GitHub Desktop.
Parser class to parse the arguments of custom solr function
package com.solrExample.solr4;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.solr.search.FunctionQParser;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.search.ValueSourceParser;
/**
*
* Created May 10, 2016 2:52:25 PM
* @author chaitanya
*/
public class AvailabilityParser extends ValueSourceParser {
@Override
public ValueSource parse(FunctionQParser fp) throws SyntaxError {
String startDateTime = fp.parseArg();
String endDateTime = fp.parseArg();
String fieldName = fp.parseArg();
return new AvailabilityValueSource(startDateTime, endDateTime, fieldName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment