处理lucene特殊字符
@param condition
@return
484631
public static String handleLuceneSpecialChars(String condition){
		if(condition == null || condition.equals("")){
			return condition;
		}
		condition = condition.replace(":","/:");
		condition = condition.replace("-","/-");
		condition = condition.replace("+","/+");
		condition = condition.replace("&","/&");
		condition = condition.replace("!","/!");
		condition = condition.replace("{","/{");
		condition = condition.replace("}","/}");
		condition = condition.replace("(","/(");
		condition = condition.replace(")","/)");
		condition = condition.replace("|","/|");

		condition = condition.replace("~","/~");
		condition = condition.replace("*","/*");
		condition = condition.replace("?","/?");
		condition = condition.replace("/","//");
//		condition = condition.replace("\"","/\"");

		return condition;
	}
910488
public List<SecondaryIndexSearcher> getIndexSearchersForQuery(List<IndexExpression> clause)
    {
        Map<String, Set<ByteBuffer>> groupByIndexType = new HashMap<>();

        //Group columns by type
        for (IndexExpression ix : clause)
        {
            SecondaryIndex index = getIndexForColumn(ix.column);

            if (index == null || !index.supportsOperator(ix.operator))
                continue;

            Set<ByteBuffer> columns = groupByIndexType.get(index.indexTypeForGrouping());

            if (columns == null)
            {
                columns = new HashSet<>();
                groupByIndexType.put(index.indexTypeForGrouping(), columns);
            }

            columns.add(ix.column);
        }

        List<SecondaryIndexSearcher> indexSearchers = new ArrayList<>(groupByIndexType.size());

        //create searcher per type
        for (Set<ByteBuffer> column : groupByIndexType.values())
            indexSearchers.add(getIndexForColumn(column.iterator().next()).createSecondaryIndexSearcher(column));

        return indexSearchers;
    }
199511
public final Cursor<T> select (Connection conn, String condition)
    {
        String query = "select " + listOfFields + " from " + name +
            " " + condition;
        return new Cursor<T>(this, conn, query);
    }
189698
public void addCondition(final Condition condition) {
        if (conditions_ == null) {
            conditions_ = new ArrayList<>();
        }
        conditions_.add(condition);
    }
1205116
public function find_index( $condition ) {
		$index = -1;

		for ( $i = 0, $count = count( $this->elements ); $i < $count; $i++ ) {
			if ( call_user_func( $condition, ($this->at( $i ) ) ) ) {
				$index = $i;
				break;
			}
		}

		return $index;
	}
391740
public static Specification<JpaTarget> likeIdOrNameOrDescription(final String searchText) {
        return (targetRoot, query, cb) -> {
            final String searchTextToLower = searchText.toLowerCase();
            return cb.or(cb.like(cb.lower(targetRoot.get(JpaTarget_.controllerId)), searchTextToLower),
                    cb.like(cb.lower(targetRoot.get(JpaTarget_.name)), searchTextToLower),
                    cb.like(cb.lower(targetRoot.get(JpaTarget_.description)), searchTextToLower));
        };
    }
668052
private Optional<IndexBooleanExpression> getSupplementaryCondition(Set<String> allColumnsInColumnRelations, Map<String, Set<Object>> condition) {
        Map<String, Set<Object>> fixedValuesMap = condition.keySet().stream()
                .filter(cn -> !allColumnsInColumnRelations.contains(cn))
                .collect(Collectors.toMap(Function.identity(), condition::get));
        return fixedValuesMap.isEmpty() ?
                Optional.empty() :
                Optional.of(new IndexBooleanExpression(fixedValuesMap));
    }
1370586
@CheckResult
    @NonNull
    public final PowerAdapter showOnlyWhile(@NonNull Condition condition) {
        checkNotNull(condition, "condition");
        if (condition instanceof ConstantCondition) {
            if (condition.eval()) {
                return this;
            } else {
                return EMPTY;
            }
        }
        return new ConditionalAdapter(this, condition);
    }
720297
public List<MicroMetaBean> queryMetaBeanByCondition(String tableName, String condition) {
		List<MicroMetaBean> retBeanList=new ArrayList();
		/*		JdbcTemplate jdbcTemplate = (JdbcTemplate) MicroDbHolder
		.getDbSource(dbName);*/
		JdbcTemplate jdbcTemplate = getMicroJdbcTemplate();
		String sql = "select * from " + tableName + " where "+condition;
		logger.debug(sql);
		List<Map<String, Object>> retList = jdbcTemplate.queryForList(sql);
		if(retList==null){
			return retBeanList;
		}
		
		for(Map<String,Object> rowMap:retList){
			MicroMetaBean metaBean = new MicroMetaBean();
			metaBean.setId((String) rowMap.get("id"));
			metaBean.setMeta_content((String) rowMap.get("meta_content"));
			metaBean.setMeta_key((String) rowMap.get("meta_key"));
			metaBean.setMeta_name((String) rowMap.get("meta_name"));
			metaBean.setMeta_type((String) rowMap.get("meta_type"));
			metaBean.setRemark((String) rowMap.get("remark"));
			metaBean.setCreate_time((Date) rowMap.get("create_time"));
			metaBean.setUpdate_time((Date) rowMap.get("update_time"));
			retBeanList.add(metaBean);
		}
		return retBeanList;
	}
991895
protected LocaleSymbol setupConditionLocaleSymbol(final ConditionFormatter formatter, final Token.Condition token) {

        final Matcher matcher = PATTERN_CONDITION_LOCALE_SYMBOL.matcher(token.getValue());
        if(!matcher.matches()) {
            throw new IllegalArgumentException("not match condition:" + token.getValue());
        }

        final String symbol = matcher.group(1);
        final String number = matcher.group(2);

        // 16進数=>10進数に直す
        final int value = Integer.valueOf(number, 16);
        MSLocale locale = MSLocale.createKnownLocale(value);
        if(locale == null) {
            locale = new MSLocale(value);
        }

        formatter.setLocale(locale);

        return new LocaleSymbol(locale, symbol);

    }
619385
public static IndriQueryerBuilder queryerForIndex(File indexDir) {
    final IndriQueryerBuilder builder = new IndriQueryerBuilder();
    builder.addIndex(indexDir);
    return builder;
  }
1326269
private Map<String, ConditionsByKey> groupConditionsByTypeAndKey(
            List<Condition> conditions) {
        Map<String, ConditionsByKey> conditionsByType = new LinkedHashMap<String, ConditionsByKey>();

        String type;
        String key;
        ConditionsByKey conditionsByKey;
        for (Condition condition : conditions) {
            type = condition.getType();
            key = condition.getConditionKey();

            if (!(conditionsByType.containsKey(type))) {
                conditionsByType.put(type, new ConditionsByKey());
            }

            conditionsByKey = conditionsByType.get(type);
            conditionsByKey.addValuesToKey(key, condition.getValues());
        }
        return conditionsByType;
    }
105718
public SearchResponse searchAll(boolean isSetExplain, String[] indices,
            String[] types, QueryBuilder filterQueryBuilder) {
        return searchAll(isSetExplain, indices, types,
                filterQueryBuilder, null);
    }
199382
public LuceneIndex current() {
    // Reopen index searcher if necessary.
    IndexSearcher oldSearcher = index.searcher.get();

    try {
      // Guarded lock, to prevent us from unnecessarily synchronizing every time.
      if (oldSearcher == null) {
        synchronized (this) {
          if ((oldSearcher = index.searcher.get()) == null) {
            IndexSearcher newSearcher = new IndexSearcher(index.directory);
            index.searcher.compareAndSet(null, newSearcher);
          }
        }

        // Yes it's open, but is it stale?
      } else {
        DirectoryReader directoryReader = DirectoryReader.openIfChanged(index.directory);
        if (null != directoryReader) {
          index.directory = directoryReader;

          synchronized (this) {
            IndexSearcher newSearcher;
            try {
              newSearcher = new IndexSearcher(directoryReader);
            } catch (AlreadyClosedException e) {
              log.warning("Old index reader could not be reopened. Opening a new one...");
              newSearcher = new IndexSearcher(DirectoryReader.open(index.writer, true));
            }
            if (!index.searcher.compareAndSet(oldSearcher, newSearcher)) {
              // Someone beat us to it. No worries.
              log.finest("Another searcher was already open for this index. Nothing to do.");
            }
          }
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    return index;
  }
693124
public static <S, D> Condition<S, D> not(Condition<S, D> condition) {
    Assert.notNull(condition, "condition");
    return new Not<S, D>(condition);
  }
1327124
public List<Condition> getAndConditions() {
		if (null == subConditions) {
			return null;
		}
		List<Condition> ret = new ArrayList<Condition>();
		for (Condition subContion : subConditions) {
			if (AND.equals(subContion.joinType)) {
				ret.add(subContion);
			}
		}
		return ret;
	}
153193
private static Set<Key> conditionToKeys(int keyLength, Map<String, Set<Object>> condition) {
        return crossProduct(new ArrayList<>(condition.values())).stream()
                    .map(v -> Keys.key(keyLength, v.toArray()))
                    .collect(Collectors.toSet());
    }