Exemplo n.º 1
0
 @Override
 public Filter termFilter(Object value, @Nullable QueryParseContext context) {
   if (context == null) {
     return super.termFilter(value, context);
   }
   BytesRef bValue = BytesRefs.toBytesRef(value);
   // we use all types, cause we don't know if its exact or not...
   BytesRef[] typesValues = new BytesRef[context.mapperService().types().size()];
   int i = 0;
   for (String type : context.mapperService().types()) {
     typesValues[i++] = Uid.createUidAsBytes(type, bValue);
   }
   return new TermsFilter(names.indexName(), typesValues);
 }
Exemplo n.º 2
0
 @Override
 public Filter termsFilter(List values, @Nullable QueryParseContext context) {
   if (context == null) {
     return super.termsFilter(values, context);
   }
   List<BytesRef> bValues = new ArrayList<BytesRef>(values.size());
   for (Object value : values) {
     BytesRef bValue = BytesRefs.toBytesRef(value);
     // we use all types, cause we don't know if its exact or not...
     for (String type : context.mapperService().types()) {
       bValues.add(Uid.createUidAsBytes(type, bValue));
     }
   }
   return new TermsFilter(names.indexName(), bValues);
 }