@Override public TokenStream create(TokenStream tokenStream) { CommonGramsFilter filter = new CommonGramsFilter(tokenStream, words); if (queryMode) { return new CommonGramsQueryFilter(filter); } else { return filter; } }
static Object[] newFilterArgs(Random random, TokenStream stream, Class<?>[] paramTypes) { Object[] args = new Object[paramTypes.length]; for (int i = 0; i < args.length; i++) { Class<?> paramType = paramTypes[i]; if (paramType == TokenStream.class) { args[i] = stream; } else if (paramType == CommonGramsFilter.class) { // TODO: fix this one, thats broken: CommonGramsQueryFilter takes this one explicitly args[i] = new CommonGramsFilter(stream, newRandomArg(random, CharArraySet.class)); } else { args[i] = newRandomArg(random, paramType); } } return args; }
/** * Create a CommonGramsFilter and wrap it with a CommonGramsQueryFilter */ @Override public CommonGramsQueryFilter create(TokenStream input) { CommonGramsFilter commonGrams = new CommonGramsFilter(luceneMatchVersion, input, commonWords); CommonGramsQueryFilter commonGramsQuery = new CommonGramsQueryFilter( commonGrams); return commonGramsQuery; }
static Object[] newFilterArgs(Random random, TokenStream stream, Class<?>[] paramTypes) { Object[] args = new Object[paramTypes.length]; for (int i = 0; i < args.length; i++) { Class<?> paramType = paramTypes[i]; if (paramType == TokenStream.class) { args[i] = stream; } else if (paramType == CommonGramsFilter.class) { // TODO: fix this one, thats broken: CommonGramsQueryFilter takes this one explicitly args[i] = new CommonGramsFilter(TEST_VERSION_CURRENT, stream, newRandomArg(random, CharArraySet.class)); } else { args[i] = newRandomArg(random, paramType); } } return args; }
/** * Create a CommonGramsFilter and wrap it with a CommonGramsQueryFilter */ @Override public TokenFilter create(TokenStream input) { CommonGramsFilter commonGrams = (CommonGramsFilter) super.create(input); return new CommonGramsQueryFilter(commonGrams); }
@Override public CommonGramsFilter create(TokenStream input) { CommonGramsFilter commonGrams = new CommonGramsFilter(luceneMatchVersion, input, commonWords); return commonGrams; }