@Test public void parseFacetField() { String a = "created,modified"; String b = "cm:created,modified"; String c = "modified"; String d = "{crazy}created,modified,updated"; String e = "{bob:\"fred\"}created,modified,updated"; String f = "{perc=\"3,4,5\"}created,modified"; String g = "{perc='3,4,5'}created,modified"; assertEquals(2, RewriteFacetParametersComponent.parseFacetField(a).length); assertEquals(2, RewriteFacetParametersComponent.parseFacetField(b).length); assertEquals(1, RewriteFacetParametersComponent.parseFacetField(c).length); assertEquals(3, RewriteFacetParametersComponent.parseFacetField(d).length); assertEquals(3, RewriteFacetParametersComponent.parseFacetField(e).length); assertEquals(2, RewriteFacetParametersComponent.parseFacetField(f).length); assertEquals(2, RewriteFacetParametersComponent.parseFacetField(g).length); }
public static String[] parseFacetField(String line) { if(StringUtils.isEmpty(line)) { throw new RuntimeException("String input is requried"); } String[] tokens = line.split(",(?=(?:[^'|\"]*\"[^'|\"]*\")*[^'|\"]*$)", -1); return tokens; }
RewriteFacetParametersComponent extends SearchComponent { public static String[] parseFacetField(String line) { if(StringUtils.isEmpty(line)) { throw new RuntimeException("String input is requried"); } String[] tokens = line.split(",(?=(?:[^'|\"]*\"[^'|\"]*\")*[^'|\"]*$)", -1); return tokens; } }
RewriteFacetParametersComponent extends SearchComponent { public static String[] parseFacetField(String line) { if(StringUtils.isEmpty(line)) { throw new RuntimeException("String input is requried"); } String[] tokens = line.split(",(?=(?:[^'|\"]*\"[^'|\"]*\")*[^'|\"]*$)", -1); return tokens; }  }
RewriteFacetParametersComponent extends SearchComponent { public static String[] parseFacetField(String line) { if(StringUtils.isEmpty(line)) { throw new RuntimeException("String input is requried"); } String[] tokens = line.split(",(?=(?:[^'|\"]*\"[^'|\"]*\")*[^'|\"]*$)", -1); return tokens; }  @Override void prepare(ResponseBuilder rb); static String[] parseFacetField(String line); @Override void process(ResponseBuilder rb); @Override String getDescription(); @Override String getSource(); }
RewriteFacetParametersComponent extends SearchComponent { public static String[] parseFacetField(String line) { if(StringUtils.isEmpty(line)) { throw new RuntimeException("String input is requried"); } String[] tokens = line.split(",(?=(?:[^'|\"]*\"[^'|\"]*\")*[^'|\"]*$)", -1); return tokens; }  @Override void prepare(ResponseBuilder rb); static String[] parseFacetField(String line); @Override void process(ResponseBuilder rb); @Override String getDescription(); @Override String getSource();  }