Package org.apache.lucene.search

Examples of org.apache.lucene.search.Filter


            return Collections.EMPTY_LIST;
        }

        LocationOccurrence location = query.getOccurrence();
        int maxResults = query.getMaxResults() > 0 ? query.getMaxResults() : DEFAULT_MAX_RESULTS;
        Filter filter = buildFilter(query);
        List<ResolvedLocation> matches;
        try {
            // attempt to find an exact match for the query
            matches = executeQuery(location, sanitizedLocationName, filter, maxResults, false, query.isFilterDupes(), null);
            if (LOG.isDebugEnabled()) {
View Full Code Here


                codeQuery.add(new TermQuery(new Term(FEATURE_CODE.key(), code.name())), Occur.SHOULD);
            }
            queryParts.add(codeQuery);
        }

        Filter filter = null;
        if (!queryParts.isEmpty()) {
            BooleanQuery bq = new BooleanQuery();
            for (Query part : queryParts) {
                bq.add(part, Occur.MUST);
            }
View Full Code Here

                QueryParser partialParser = new QueryParser(Version.LUCENE_30, "CONTENT", analyzer);
                query = partialParser.parse(term);
            }

            // TODO: なんか汚い...。
            Filter filter;
            if (beforeDeadlineOnly) {
                long current = new Date().getTime();
                if (EventCategory.getAllEventCategory().equals(category) || "".equals(category)) {
                    Query filterQuery = new TermRangeQuery("DEADLINE-TIME", TimeUtil.getTimeString(current), TimeUtil.getTimeString(Long.MAX_VALUE), true, true);
                    filter = new QueryWrapperFilter(filterQuery);
View Full Code Here

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);
   
    //document
    Document document = new Document();
    document.add(new Field("field", "a sample", Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field("filter", "a sample filter", Field.Store.YES, Field.Index.TOKENIZED));
View Full Code Here

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);
   
    //document
    Document document = new Document();
    document.add(new Field("field", "a sample", Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field("filter", "a sample filter", Field.Store.YES, Field.Index.TOKENIZED));
View Full Code Here

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);

    //sort
    Sort sort = new Sort("sort");
   
    //document
View Full Code Here

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);

    //sort
    Sort sort = new Sort("sort");
   
    //document
View Full Code Here

      return; // there is nothing to do if we don't have any filter definitions
    }

    ChainedFilter chainedFilter = new ChainedFilter();
    for ( FullTextFilterImpl fullTextFilter : filterDefinitions.values() ) {
      Filter filter = buildLuceneFilter( fullTextFilter );
      chainedFilter.addFilter( filter );
    }

    if ( filter != null ) {
      chainedFilter.addFilter( filter );
View Full Code Here

    FilterDef def = searchFactoryImplementor.getFilterDefinition( fullTextFilter.getName() );
    Object instance = createFilterInstance( fullTextFilter, def );
    FilterKey key = createFilterKey( def, instance );

    // try to get the filter out of the cache
    Filter filter = cacheInstance( def.getCacheMode() ) ?
        searchFactoryImplementor.getFilterCachingStrategy().getCachedFilter( key ) :
        null;

    if ( filter == null ) {
      filter = createFilter( def, instance );
View Full Code Here

    }
    return filter;
  }

  private Filter createFilter(FilterDef def, Object instance) {
    Filter filter;
    if ( def.getFactoryMethod() != null ) {
      try {
        filter = ( Filter ) def.getFactoryMethod().invoke( instance );
      }
      catch ( IllegalAccessException e ) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.Filter

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.