Java 类org.apache.lucene.search.FilteredQuery.FilterStrategy 实例源码

项目:search    文件:TestUtil.java   
public static final FilterStrategy randomFilterStrategy(final Random random) {
  switch(random.nextInt(6)) {
    case 5:
    case 4:
      return new FilteredQuery.RandomAccessFilterStrategy() {
        @Override
        protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
          return LuceneTestCase.random().nextBoolean();
        }
      };
    case 3:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
    case 2:
      return FilteredQuery.LEAP_FROG_FILTER_FIRST_STRATEGY;
    case 1:
      return FilteredQuery.LEAP_FROG_QUERY_FIRST_STRATEGY;
    case 0: 
      return FilteredQuery.QUERY_FIRST_FILTER_STRATEGY;
    default:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
  }
}
项目:NYBC    文件:_TestUtil.java   
public static final FilterStrategy randomFilterStrategy(final Random random) {
  switch(random.nextInt(6)) {
    case 5:
    case 4:
      return new FilteredQuery.RandomAccessFilterStrategy() {
        @Override
        protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
          return LuceneTestCase.random().nextBoolean();
        }
      };
    case 3:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
    case 2:
      return FilteredQuery.LEAP_FROG_FILTER_FIRST_STRATEGY;
    case 1:
      return FilteredQuery.LEAP_FROG_QUERY_FIRST_STRATEGY;
    case 0: 
      return FilteredQuery.QUERY_FIRST_FILTER_STRATEGY;
    default:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestUtil.java   
public static final FilterStrategy randomFilterStrategy(final Random random) {
  switch(random.nextInt(6)) {
    case 5:
    case 4:
      return new FilteredQuery.RandomAccessFilterStrategy() {
        @Override
        protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
          return LuceneTestCase.random().nextBoolean();
        }
      };
    case 3:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
    case 2:
      return FilteredQuery.LEAP_FROG_FILTER_FIRST_STRATEGY;
    case 1:
      return FilteredQuery.LEAP_FROG_QUERY_FIRST_STRATEGY;
    case 0: 
      return FilteredQuery.QUERY_FIRST_FILTER_STRATEGY;
    default:
      return FilteredQuery.RANDOM_ACCESS_FILTER_STRATEGY;
  }
}
项目:search    文件:TestFilteredQuery.java   
private static FilteredQuery.FilterStrategy randomFilterStrategy(Random random, final boolean useRandomAccess) {
  if (useRandomAccess) {
    return new FilteredQuery.RandomAccessFilterStrategy() {
      @Override
      protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
        return true;
      }
    };
  }
  return TestUtil.randomFilterStrategy(random);
}
项目:NYBC    文件:TestFilteredQuery.java   
private static FilteredQuery.FilterStrategy randomFilterStrategy(Random random, final boolean useRandomAccess) {
  if (useRandomAccess) {
    return  new FilteredQuery.RandomAccessFilterStrategy() {
      @Override
      protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
        return useRandomAccess;
      }
    };
  }
  return _TestUtil.randomFilterStrategy(random);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestFilteredQuery.java   
private static FilteredQuery.FilterStrategy randomFilterStrategy(Random random, final boolean useRandomAccess) {
  if (useRandomAccess) {
    return  new FilteredQuery.RandomAccessFilterStrategy() {
      @Override
      protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {
        return useRandomAccess;
      }
    };
  }
  return _TestUtil.randomFilterStrategy(random);
}
项目:search    文件:TestFilteredQuery.java   
private FilterStrategy randomFilterStrategy() {
  return randomFilterStrategy(random(), true);
}
项目:search    文件:TestFilteredQuery.java   
public void testGetFilterStrategy() {
  FilterStrategy randomFilterStrategy = randomFilterStrategy();
  FilteredQuery filteredQuery = new FilteredQuery(new TermQuery(new Term("field", "one")), new PrefixFilter(new Term("field", "o")), randomFilterStrategy);
  assertSame(randomFilterStrategy, filteredQuery.getFilterStrategy());
}
项目:NYBC    文件:TestFilteredQuery.java   
private FilterStrategy randomFilterStrategy() {
  return randomFilterStrategy(random(), true);
}
项目:NYBC    文件:TestFilteredQuery.java   
public void testGetFilterStrategy() {
  FilterStrategy randomFilterStrategy = randomFilterStrategy();
  FilteredQuery filteredQuery = new FilteredQuery(new TermQuery(new Term("field", "one")), new PrefixFilter(new Term("field", "o")), randomFilterStrategy);
  assertSame(randomFilterStrategy, filteredQuery.getFilterStrategy());
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestFilteredQuery.java   
private FilterStrategy randomFilterStrategy() {
  return randomFilterStrategy(random(), true);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestFilteredQuery.java   
public void testGetFilterStrategy() {
  FilterStrategy randomFilterStrategy = randomFilterStrategy();
  FilteredQuery filteredQuery = new FilteredQuery(new TermQuery(new Term("field", "one")), new PrefixFilter(new Term("field", "o")), randomFilterStrategy);
  assertSame(randomFilterStrategy, filteredQuery.getFilterStrategy());
}