Client library for Apache Solr 7 months in development built on-top of SolrJ (for now) A promise: All code compiles, has tests and uses no reflection Monday, 14 October 13
StringField("s2_id"); StringField TYPE = new StringField("s2_type"); StringField TAG = new StringField("tag"); StringField AUTHOR = new StringField("dc_creator"); IntegerField SCENE_COUNT = new IntegerField("scene_count"); DateField DATE = new DateField("dc_issued"); Monday, 14 October 13
public static class Schema extends ContentItem.Schema<Play> { public Schema() { super(ID); type = field(TYPE).build(); author = field(AUTHOR.multivalued()) .transform(asList(Author.parse())) .build(); ... filter(TYPE.equalTo("play")); } public Play create(Map<DataKey<?>, ? super Object> data) { return new Play(this, data); } } ... Monday, 14 October 13
OR scene_count:[5 TO *] DATE.greaterThan(new Date()).or( TAG.equalTo("Future").or(TAG.equalTo("Year 3000")).group()); dc_issued:{2013-10-10T15:34:13.020Z TO *] OR (tag:Future OR tag:Year\ 3000) Monday, 14 October 13
special chars & spaces Type Safety Avoids undefined solr behavior thing:A OR stuff:B AND thing:C thing:A OR (stuff:B AND thing:C) Monday, 14 October 13
special chars & spaces Type Safety Avoids undefined solr behavior thing:A OR stuff:B AND thing:C thing:A OR (stuff:B AND thing:C) (thing:A OR stuff:B) AND thing:C Monday, 14 October 13
special chars & spaces Type Safety Avoids undefined solr behavior thing:A OR stuff:B AND thing:C thing:A OR (stuff:B AND thing:C) (thing:A OR stuff:B) AND thing:C stuff:B AND thing:C Monday, 14 October 13
plays = field(CHILD_IDS.multivalued()) .transform(asList(foreignKeyField(Play.class))) .build() ... } public List<Play> getPlays() { return get(schema.plays); } } Rigel can be a kind of ORM The transformation chain is lazy There is an option to make it eager too... Monday, 14 October 13
dateFacet = facet(DATE).build(); rangeFacet = rangeFacet(SCENE_COUNT) .start(0) .gap(1) .end(10) .build(); } } Out of the Box Search is possible Monday, 14 October 13
SolrDocument to boolean) Used to decide what Content Item to create You can evaluate the behavior of a Filter without sending the request to Solr (only on non tokenized fields) Monday, 14 October 13
type of the field, its comparable e.g. Long, Integer * F = the formatted type (what the transorm func turns our Range<R> into) * B = The solrj range facet type (Number or Date) * G = The solrj gap type, Number or String */ public abstract class RangeFacetResults<R extends Comparable<R>,F,B,G> extends FacetResults<Range<R>, F> I’ve learnt a lot mainly to dislike type erasure Monday, 14 October 13