Package com.browseengine.bobo.facets.filter

Examples of com.browseengine.bobo.facets.filter.RandomAccessFilter


          {
            BrowseSelection sel = new BrowseSelection(field);
            sel.setValues(new String[]{path});
            sel.setSelectionProperty(PathFacetHandler.SEL_PROP_NAME_DEPTH, String.valueOf(depth));
            sel.setSelectionProperty(PathFacetHandler.SEL_PROP_NAME_STRICT, String.valueOf(strict));
            RandomAccessFilter filter = ((PathFacetHandler)facetHandler).buildFilter(sel);
            if (filter == null) {
              return SenseiDocIdSet.buildMatchAll(reader, "PATH " + field);
            }
            return SenseiDocIdSet.build(filter, boboReader, "PATH " + field);
          }
View Full Code Here


      if (_isAnd) {
        sel.setSelectionOperation(ValueOperation.ValueOperationAnd);
      } else {
        sel.setSelectionOperation(ValueOperation.ValueOperationOr);
      }
      RandomAccessFilter filter = facetHandler.buildFilter(sel);
      if (filter == null)
        filter = EmptyFilter.getInstance();

      // If we don't have an cardinality estimate, ask Bobo.
      if (totalDocIdSetCardinality == null) {
        totalDocIdSetCardinality = DocIdSetCardinality.exact(filter.getFacetSelectivity(boboReader));
        // Zero means 'delete', and I don't trust Bobo enough.
        if (totalDocIdSetCardinality.isZero()) {
          totalDocIdSetCardinality = DocIdSetCardinality.exactRange(0.0, 0.001);
        }
      }

      return new SenseiDocIdSet(filter.getDocIdSet(boboReader), totalDocIdSetCardinality, planString(planType, vals, nots, optimizedVals, optimizedNots));

    } else{
      throw new IllegalStateException("read not instance of "+BoboIndexReader.class);
    }
  }
View Full Code Here

      throws IOException {

    ArrayList<RandomAccessFilter> filterList = new ArrayList<RandomAccessFilter>(vals.length);

    for (String val : vals) {
      RandomAccessFilter f = buildRandomAccessFilter(val, prop);
      if (f != null) {
        filterList.add(f);
      } else {
        return EmptyFilter.getInstance();
      }
View Full Code Here

  }

  @Override
  public RandomAccessFilter buildRandomAccessOrFilter(String[] vals, Properties prop, boolean isNot)
      throws IOException {
    RandomAccessFilter filter = null;
    if (vals.length > 1) {
      MultiValueORFacetFilter f = new MultiValueORFacetFilter(this, vals, false); // catch the "not"
                                                                                  // case later
      if (!isNot) {
        AdaptiveFacetFilter af = new AdaptiveFacetFilter(new SimpleDataCacheBuilder(getName(),
View Full Code Here

  public RandomAccessFilter buildRandomAccessAndFilter(String[] vals, Properties prop)
      throws IOException {
    ArrayList<RandomAccessFilter> filterList = new ArrayList<RandomAccessFilter>(vals.length);

    for (String val : vals) {
      RandomAccessFilter f = buildRandomAccessFilter(val, prop);
      if (f != null) {
        filterList.add(f);
      } else {
        return EmptyFilter.getInstance();
      }
View Full Code Here

  }

  @Override
  public RandomAccessFilter buildRandomAccessOrFilter(String[] vals, Properties prop, boolean isNot)
      throws IOException {
    RandomAccessFilter filter = null;

    if (vals.length > 0) {
      filter = new CompactMultiValueFacetFilter(this, vals);
    } else {
      filter = EmptyFilter.getInstance();
View Full Code Here

          continue;
        }

        FacetHitCollector facetHitCollector = null;

        RandomAccessFilter filter = null;
        if (sel != null) {
          filter = handler.buildFilter(sel);
        }

        if (ospec == null) {
View Full Code Here

      if (reader instanceof BoboSegmentReader) {
        BoboSegmentReader boboReader = (BoboSegmentReader) reader;
        FacetHandler<?> fhandler = boboReader.getFacetHandler(FacetTermQuery.this._name);
        if (fhandler != null) {
          DocIdSetIterator dociter = null;
          RandomAccessFilter filter = fhandler.buildFilter(FacetTermQuery.this._sel);
          if (filter != null) {
            RandomAccessDocIdSet docset = filter.getRandomAccessDocIdSet(boboReader);
            if (docset != null) {
              dociter = buildIterator(docset, boboReader, acceptDocs);
            }
          }
          if (dociter == null) {
View Full Code Here

  public RandomAccessFilter buildFilter(BrowseSelection sel) throws IOException {
    String[] selections = sel.getValues();
    String[] notSelections = sel.getNotValues();
    Properties prop = sel.getSelectionProperties();

    RandomAccessFilter filter = null;
    if (selections != null && selections.length > 0) {
      if (sel.getSelectionOperation() == ValueOperation.ValueOperationAnd) {
        filter = buildRandomAccessAndFilter(selections, prop);
        if (filter == null) {
          filter = EmptyFilter.getInstance();
        }
      } else {
        filter = buildRandomAccessOrFilter(selections, prop, false);
        if (filter == null) {
          return EmptyFilter.getInstance();
        }
      }
    }

    if (notSelections != null && notSelections.length > 0) {
      RandomAccessFilter notFilter = buildRandomAccessOrFilter(notSelections, prop, true);
      if (filter == null) {
        filter = notFilter;
      } else {
        RandomAccessFilter andFilter = new RandomAccessAndFilter(
            Arrays.asList(new RandomAccessFilter[] { filter, notFilter }));
        filter = andFilter;
      }
    }
View Full Code Here

  public RandomAccessFilter buildRandomAccessAndFilter(String[] vals, Properties prop)
      throws IOException {
    ArrayList<RandomAccessFilter> filterList = new ArrayList<RandomAccessFilter>(vals.length);

    for (String val : vals) {
      RandomAccessFilter f = buildRandomAccessFilter(val, prop);
      if (f != null) {
        filterList.add(f);
      } else {
        return EmptyFilter.getInstance();
      }
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.facets.filter.RandomAccessFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.