Package org.apache.lucene.queries

Examples of org.apache.lucene.queries.TermsFilter$FieldAndTermEnum


    catch (IOException ioe) {
      throw new RuntimeException("Error constructing terms from index:" + ioe);
    } finally {
      IOUtils.closeWhileHandlingException(ts);
    }
    return new TermsFilter(fieldName, terms);
  }
View Full Code Here


    BytesRef[] terms = new BytesRef[cells.size()];
    int i = 0;
    for (Cell cell : cells) {
      terms[i++] = new BytesRef(cell.getTokenString());
    }
    return new TermsFilter(getFieldName(), terms);
  }
View Full Code Here

    BytesRef[] terms = new BytesRef[cells.size()];
    int i = 0;
    for (Node cell : cells) {
      terms[i++] = new BytesRef(cell.getTokenString());
    }
    return new TermsFilter(getFieldName(), terms);
  }
View Full Code Here

      ts.close();
    }
    catch (IOException ioe) {
      throw new RuntimeException("Error constructing terms from index:" + ioe);
    }
    return new TermsFilter(fieldName, terms);
  }
View Full Code Here

      ts.close();
    }
    catch (IOException ioe) {
      throw new RuntimeException("Error constructing terms from index:" + ioe);
    }
    return new TermsFilter(fieldName, terms);
  }
View Full Code Here

    catch (IOException ioe) {
      throw new RuntimeException("Error constructing terms from index:" + ioe);
    } finally {
      IOUtils.closeWhileHandlingException(ts);
    }
    return new TermsFilter(fieldName, terms);
  }
View Full Code Here

    BytesRef[] terms = new BytesRef[cells.size()];
    int i = 0;
    for (Cell cell : cells) {
      terms[i++] = new BytesRef(cell.getTokenString());//TODO use cell.getTokenBytes()
    }
    return new TermsFilter(getFieldName(), terms);
  }
View Full Code Here

                if (map==Mapping.STRING && titanPredicate.toString().startsWith("CONTAINS"))
                    throw new IllegalArgumentException("String mapped string values do not support CONTAINS queries: " + titanPredicate);

                if (titanPredicate == Text.CONTAINS) {
                    value = ((String) value).toLowerCase();
                    return new TermsFilter(new Term(key, (String) value));
                } else if (titanPredicate == Text.CONTAINS_PREFIX) {
                    value = ((String) value).toLowerCase();
                    return new PrefixFilter(new Term(key, (String) value));
                } else if (titanPredicate == Text.PREFIX) {
                    return new PrefixFilter(new Term(key, (String) value));
//                } else if (titanPredicate == Text.CONTAINS_REGEX) {
//                    value = ((String) value).toLowerCase();
//                    return new RegexpQuery(new Term(key,(String)value));
                } else if (titanPredicate == Cmp.EQUAL) {
                    return new TermsFilter(new Term(key,(String)value));
                } else if (titanPredicate == Cmp.NOT_EQUAL) {
                    BooleanFilter q = new BooleanFilter();
                    q.add(new TermsFilter(new Term(key,(String)value)), BooleanClause.Occur.MUST_NOT);
                    return q;
                } else
                    throw new IllegalArgumentException("Relation is not supported for string value: " + titanPredicate);
            } else if (value instanceof Geoshape) {
                Preconditions.checkArgument(titanPredicate == Geo.WITHIN, "Relation is not supported for geo value: " + titanPredicate);
View Full Code Here

            org.apache.lucene.index.Fields[] likeFields = fetchService.fetch(items);
            mltQuery.setLikeText(likeFields);
            boolQuery.add(mltQuery, BooleanClause.Occur.SHOULD);
            // exclude the items from the search
            if (!include) {
                TermsFilter filter = new TermsFilter(UidFieldMapper.NAME, Uid.createUids(items.getRequests()));
                ConstantScoreQuery query = new ConstantScoreQuery(filter);
                boolQuery.add(query, BooleanClause.Occur.MUST_NOT);
            }
            return boolQuery;
        }
View Full Code Here

    public Filter termsFilter(List values, @Nullable QueryParseContext context) {
        BytesRef[] bytesRefs = new BytesRef[values.size()];
        for (int i = 0; i < bytesRefs.length; i++) {
            bytesRefs[i] = indexedValueForSearch(values.get(i));
        }
        return new TermsFilter(names.indexName(), bytesRefs);
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.queries.TermsFilter$FieldAndTermEnum

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.