@@ -0,0 +1,925 @@
+package com.sensei.search.query;%0A%0Aimport org.apache.lucene.search.Query;%0A%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0Aimport com.sensei.plugin.SenseiPlugin;%0A%0Apublic class CustomQueryConstructor extends QueryConstructor%0A%7B%0A  public static final String QUERY_TYPE = %22custom%22;%0A%0A  // %22term%22 : %7B%0A  //   %22color%22 : %22red%22%0A  // %0A  //   // or %22color%22 : %7B%22term%22 : %22red%22, %22boost%22: 2.0%7D%0A  // %7D,%0A%0A  @Override%0A  protected Query doConstructQuery(JSONObject jsonQuery) throws JSONException%0A  %7B%0A    try%0A    %7B%0A      String className = jsonQuery.getString(%22class%22);%0A      Class queryClass = Class.forName(className);%0A%0A      Object q = queryClass.newInstance();%0A      ((SenseiPlugin)q).initialize(jsonQuery.optJSONObject(%22params%22));%0A%0A      ((Query)q).setBoost((float)jsonQuery.optDouble(%22boost%22, 1.0));%0A      return (Query)q;%0A    %7D%0A    catch(Throwable t)%0A    %7B%0A      throw new IllegalArgumentException(t.getMessage());%0A    %7D%0A  %7D%0A%7D%0A

add custom query.