@Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { String field=fp.parseArg(); // eg. cl_hi String featureString = fp.parseArg(); // System.out.println(featureString); byte[] hist= Base64.decodeBase64(featureString); // eg. FQY5DhMYDg0ODg0PEBEPDg4ODg8QEgsgEBAQEBAgEBAQEBA= double maxDistance = Double.MAX_VALUE; if (fp.hasMoreArguments()) { // if there is a third argument, it's the max value to return if there is none. Note the query cache is not updated upon parameter change. maxDistance = Double.parseDouble(fp.parseArg()); } return new LireValueSource(field, hist, maxDistance); } }
private static ParamInfo parseTerm(FunctionQParser fp) throws SyntaxError { ParamInfo paramInfo = new ParamInfo(); paramInfo.field = fp.parseArg(); String textVal = fp.parseArg(); if(textVal == null || textVal.trim().length() == 0){ return paramInfo; } if(fp.hasMoreArguments()){ String similarity = fp.parseArg().toLowerCase().trim(); if( !similarity.equals(SimilarityType.DOC_LEN) && !similarity.equals(SimilarityType.PARAM_LEN) && !similarity.equals(SimilarityType.DICE) && !similarity.equals(SimilarityType.JACCARD)){ log.error(String.format("Invalid similarity class: %s. Defaulting to %s", similarity, SimilarityType.DOC_LEN)); similarity = SimilarityType.DOC_LEN; } paramInfo.similarity = similarity; } // need to do analysis on the term Analyzer analyzer = fp.getReq().getSchema().getIndexAnalyzer(); paramInfo.analyzer = analyzer; try { List<String> terms = TermExtractionHelper.getTermsFromString(analyzer, paramInfo.field, textVal); paramInfo.terms = new HashSet<String>(terms); } catch (IOException e) { SolrException.log(log, "Exception during debug", e); return null; } return paramInfo; }
public ValueSource parse(FunctionQParser fp) throws SyntaxError { String indexedField = fp.parseArg(); Analyzer analyzer = fp.getReq().getSchema().getIndexAnalyzer(); return new FieldIndexedValueSource(indexedField, analyzer); } }
private static FieldInfo parseTerm(FunctionQParser fp) throws SyntaxError { FieldInfo fieldInfo = new FieldInfo(); fieldInfo.indexedField = fieldInfo.field = fp.parseArg(); String textVal = fp.parseArg(); if(textVal == null || textVal.trim().length() == 0){ return fieldInfo; fieldInfo.useDocLength = fp.parseArg().toLowerCase().equals("true");
public ValueSource parse(FunctionQParser fqp) throws SyntaxError{ ValueSource value1 = fqp.parseValueSource(); ValueSource value2 = fqp.parseValueSource(); String delimiter = null; if (fqp.hasMoreArguments()){ delimiter = fqp.parseArg(); } return new ConcatenateFunction(value1, value2, delimiter); } }
public ValueSource parse(FunctionQParser fp) throws SyntaxError { String indexedField = fp.parseArg(); Analyzer analyzer = fp.getReq().getSchema().getIndexAnalyzer(); return new FieldLenValueSource(indexedField, analyzer); } }