Find the features that match the supplied search string, ProductDefinition and Visibility

@param searchString
@param definition
@param visible
@return a collection of matching feature resources
@throws RepositoryException
503391
@SuppressWarnings("unchecked")
    public Collection<EsaResource> findMatchingEsas(String searchString,
                                                    ProductDefinition definition,
                                                    Visibility visible) throws RepositoryException {
        Collection<? extends RepositoryResource> resources = findResources(searchString, Collections.singleton(definition), Collections.singleton(ResourceType.FEATURE), visible);
        return (Collection<EsaResource>) resources;
    }
134300
@Action(semantics = SemanticsOf.SAFE)
    public List<ApplicationRole> findMatching(String search) {
        if (search != null && search.length() > 0 ) {
            return findNameContaining(search);
        }
        return Lists.newArrayList();
    }
1098601
@Override
	public Features getDefaultFeatures(String url) {
		Features result = new Features();
		for (Map.Entry<String, Object> entry : defaultFeatureMap.entrySet()) {
			// value is either a Boolean or Function
			Object value = entry.getValue();
			if (value instanceof Function) {
				Context cx = Context.enter();
				try {
					Scriptable threadScope = cx.newObject(sharedScope);
					threadScope.setPrototype(sharedScope);
					threadScope.setParentScope(null);
					Boolean booleanValue = Context.toBoolean(((Function)value).call(cx, threadScope, null, new Object[]{url}));
					result.put(entry.getKey(), booleanValue);
				} finally {
					Context.exit();
				}
			} else {
				result.put(entry.getKey(), (Boolean)value);
			}
		}
		return result;
	}
1332950
private boolean isProductMatchingSearchCriteria(Product product, String searchQueryText) {
    String words[] = searchQueryText.split(" ");
    for (String w : words) {
      if (product.getName().contains(w)) return true;
      if (product.getDescription().contains(w)) return true;
      if (product.getCategory().contains(w)) return true;
    }
    return false;
  }
1033223
function InlineSearchResultExplorer(registry, commandService, inlineSearchPane, preferences, fileClient, searcher) {
        this.registry = registry;
        this._commandService = commandService;
        this.fileClient = fileClient;
        this.defaulRows = 40;
		this._contentTypeService = new mContentTypes.ContentTypeRegistry(this.registry);
		this._inlineSearchPane = inlineSearchPane;
		this._preferences = preferences;
		this._searcher = searcher;
		this._replaceRenderer =  new SearchResultRenderer({
            checkbox: true,
            highlightSelection: false,
            getCheckedFunc: function(item) {
                return this.getItemChecked(item);
            }.bind(this),
            onCheckedFunc: function(rowId, checked, manually) {
                this.onRowChecked(rowId, checked, manually);
            }.bind(this)
        }, this);
        this.render = this._normalRenderer = new SearchResultRenderer({
            checkbox: false,
            highlightSelection: false
        }, this);
    	mFileDetailRenderer.getPrefs(this._preferences, "/inlineSearchPane", ["showFullPath", "viewByFile", "hidePerfectMatch", "hideNonMatch", "hidePossibleMatch"]).then(function(properties){ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    		this._shouldShowFullPath = properties ? properties[0] : false;
    		this._viewByFile = properties ? properties[1] : false;
    		this._matchFilter = {};
    		this._matchFilter["hidePerfectMatch"] = {flag: properties ? properties[2] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 100;
    												 }};
    		this._matchFilter["hideNonMatch"] = {flag: properties ? properties[3] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 0;
    												 }};
    		this._matchFilter["hidePossibleMatch"] = {flag: properties ? properties[4] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence !== 100 && confidence !== 0;
    												 }};
    		this.declareCommands();
     	}.bind(this));
    }
906393
public Map<String, Map<String, ProvisioningFeatureDefinition>> getFeatureDefinitionsByProduct() {
        Map<String, Map<String, ProvisioningFeatureDefinition>> prodFeatureMap = new TreeMap<String, Map<String, ProvisioningFeatureDefinition>>();

        // Add feature definitions from Liberty core.
        prodFeatureMap.put(CORE_PRODUCT_NAME, getCoreProductFeatureDefinitions());

        // Add product extension feature definitions in the default usr location.
        Map<String, ProvisioningFeatureDefinition> userFeatureDefs = getUsrProductFeatureDefinitions();
        if (userFeatureDefs != null && !userFeatureDefs.isEmpty()) {
            prodFeatureMap.put(USR_PRODUCT_EXT_NAME, userFeatureDefs);
        }

        // Add product extension feature definitions that are not in the default usr location.
        readProductExtFeatureLocations();
        if (!BundleRepositoryRegistry.isEmpty()) {
            for (String productExtName : BundleRepositoryRegistry.keys()) {
                if (productExtName.isEmpty() || USR_PRODUCT_EXT_NAME.equals(productExtName))
                    continue;

                Map<String, ProvisioningFeatureDefinition> prodExtFeatureDefs = getProductExtFeatureDefinitions(productExtName);
                if (prodExtFeatureDefs != null && !prodExtFeatureDefs.isEmpty())
                    prodFeatureMap.put(productExtName, prodExtFeatureDefs);
            }
        }

        return prodFeatureMap;
    }
587963
public List<Descriptor> searchArtifacts(SessionProvider sp, SearchCriteria criteria) throws RepositoryException
   {
      Session session = currentSession(sp);

      session.refresh(true);
      session.save();

      String param = criteria.getContainsExpr();
      String pathConstraint = "";
      if (rootNodePath.length() > 1)
      { // artifact root is some real node
         if (rootNodePath.endsWith("/"))
            pathConstraint = rootNodePath + "%/" + param + "[%]";
         else
            pathConstraint = rootNodePath + "/%/" + param + "[%]";
      }
      else
      {
         pathConstraint = "/%/" + param + "[%]"; // artifact root is workspace root
      }
      // node !!

      String sqlQuery = String.format("SELECT * FROM nt:folder WHERE jcr:path LIKE '%s' ", pathConstraint);

      LOG.info(sqlQuery);
      QueryManager manager = session.getWorkspace().getQueryManager();
      Query query = manager.createQuery(sqlQuery, Query.SQL);

      QueryResult queryResult = query.execute();
      NodeIterator iterator = queryResult.getNodes();

      List<Descriptor> preciseNode = new ArrayList<Descriptor>();
      while (iterator.hasNext())
      {

         Node candidate = iterator.nextNode();

         Descriptor descriptor = new FolderDescriptor(candidate.getPath());
         preciseNode.add(descriptor);

      }

      return preciseNode;
   }
821349
@ReadOperation
    public List<ConfigurationMetadataSearchResult> search(@Selector final String name) {
        val allProps = repository.getRepository().getAllProperties();

        if (StringUtils.isNotBlank(name) && RegexUtils.isValidRegex(name)) {
            val names = StreamSupport.stream(RelaxedPropertyNames.forCamelCase(name).spliterator(), false)
                .map(Object::toString)
                .collect(Collectors.joining("|"));
            val pattern = RegexUtils.createPattern(names);
            return allProps.entrySet()
                .stream()
                .filter(propEntry -> RegexUtils.find(pattern, propEntry.getKey()))
                .map(propEntry -> new ConfigurationMetadataSearchResult(propEntry.getValue(), repository))
                .sorted()
                .collect(Collectors.toList());
        }
        return new ArrayList<>();
    }
68180
private FeatureInfo getFeatureInfo(String name,
                                       Map<String, ProductInfo> productInfos,
                                       Map<String, FeatureInfo> featuresBySymbolicName) {
        String productName, featureName;
        int index = name.indexOf(':');
        if (index == -1) {
            FeatureInfo featureInfo = featuresBySymbolicName.get(name);
            if (featureInfo != null) {
                return featureInfo;
            }

            productName = ManifestFileProcessor.CORE_PRODUCT_NAME;
            featureName = name;
        } else {
            productName = name.substring(0, index);
            featureName = name.substring(index + 1);
        }

        ProductInfo product = productInfos.get(productName);
        return product == null ? null : product.featuresByShortName.get(featureName);
    }
191218
def query(cls, visibility=None, api=None):
        
        api = api if api else cls._API

        return super(Dataset, cls)._query(
            url=cls._URL['query'],
            visibility=visibility,
            fields='_all', api=api
        )
1106060
@Action(
            domainEvent = FindUsersByNameDomainEvent.class,
            semantics = SemanticsOf.SAFE
    )
    @MemberOrder(sequence = "100.10.2")
    public List<ApplicationUser> findUsers(
            final @ParameterLayout(named = "Search") String search) {
        return applicationUserRepository.find(search);
    }
182213
@SuppressWarnings("unchecked")
    public <T> List<Serializable> findId(Class<T> clazz, SearchParameters sp, List<SingularAttribute<?, ?>> availableProperties) {
        //log.info("Searching {} with terms : {} with available Properties: {}", new Object[]{clazz.getSimpleName(), sp.getTerms(), availableProperties});
        FullTextEntityManager fullTextEntityManager = getFullTextEntityManager(entityManager);
        Query query = sp.getLuceneQueryBuilder().build(fullTextEntityManager, sp, availableProperties);

        if (query == null) {
            return null;
        }

        FullTextQuery ftq = fullTextEntityManager.createFullTextQuery( //
                query, clazz);
        ftq.setProjection("id");
        if (sp.getMaxResults() > 0) {
            ftq.setMaxResults(sp.getMaxResults());
        }
        List<Serializable> ids = newArrayList();
        List<Object[]> resultList = ftq.getResultList();
        for (Object[] result : resultList) {
            ids.add((Serializable) result[0]);
        }
        return ids;
    }
1234024
@Transactional(readOnly = true)
	public Collection<Event> find(SearchCriteria searchCriteria) {
		
//		if user exists, compare on [username]
//		if detection point exists, compare on [category, label, threshold count, threshold interval]
//		if detection system ids exist, do an "in"
//		if earliest exists, compare on [event date > earliest]
		
		CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
		CriteriaQuery<Event> criteriaQuery = criteriaBuilder.createQuery(Event.class);
		Root<Event> root = criteriaQuery.from(Event.class);
		
		Collection<Predicate> conditions = new ArrayList<>();
		
		if (searchCriteria.getUser() != null) {
			Predicate userCondition = criteriaBuilder.equal(root.get("user").get("username"), searchCriteria.getUser().getUsername());
			conditions.add(userCondition);
		}
		
		if (searchCriteria.getDetectionPoint() != null) {
			
			if (searchCriteria.getDetectionPoint().getCategory() != null) {
				Predicate categoryCondition = criteriaBuilder.equal(root.get("detectionPoint").get("category"), 
						searchCriteria.getDetectionPoint().getCategory());
				conditions.add(categoryCondition);
			}
			
			if (searchCriteria.getDetectionPoint().getLabel() != null) {
				Predicate labelCondition = criteriaBuilder.equal(root.get("detectionPoint").get("label"), 
						searchCriteria.getDetectionPoint().getLabel());
				conditions.add(labelCondition);
			}
			
			if (searchCriteria.getDetectionPoint().getThreshold() != null) {
				
				if (searchCriteria.getDetectionPoint().getThreshold().getCount() > 0) {
					Predicate countCondition = criteriaBuilder.equal(root.get("detectionPoint").get("threshold").get("count"), 
							searchCriteria.getDetectionPoint().getThreshold().getCount());
					conditions.add(countCondition);
				}
				
				if (searchCriteria.getDetectionPoint().getThreshold().getInterval() != null) {
					if (searchCriteria.getDetectionPoint().getThreshold().getInterval().getUnit() != null) {
						Predicate durationCondition = criteriaBuilder.equal(root.get("detectionPoint").get("threshold").get("interval").get("duration"), 
								searchCriteria.getDetectionPoint().getThreshold().getInterval().getDuration());
						conditions.add(durationCondition);
					}
					
					if (searchCriteria.getDetectionPoint().getThreshold().getInterval().getDuration() > 0) {
						Predicate unitCondition = criteriaBuilder.equal(root.get("detectionPoint").get("threshold").get("interval").get("unit"), 
								searchCriteria.getDetectionPoint().getThreshold().getInterval().getUnit());
						conditions.add(unitCondition);
					}
				}
				
			}
			
		}
		
		if (searchCriteria.getDetectionSystemIds() != null) {
			Predicate detectionSystemCondition = root.get("detectionSystem").get("detectionSystemId").in(searchCriteria.getDetectionSystemIds());
			conditions.add(detectionSystemCondition);
		}

		if (conditions.size() > 0) {
			criteriaQuery.where(criteriaBuilder.and(conditions.toArray(new Predicate[0])));
		}
		
		criteriaQuery.orderBy(criteriaBuilder.asc(root.get("timestamp")));

		TypedQuery<Event> query = em.createQuery(criteriaQuery); 
		List<Event> result = query.getResultList();
		
		return result;
	}
992653
public Observable<SearchViewState> search(String searchString) {
    // Empty String, so no search
    if (searchString.isEmpty()) {
      return Observable.just(new SearchViewState.SearchNotStartedYet());
    }

    // search for product
    return searchEngine.searchFor(searchString)
        .map(products -> {
          if (products.isEmpty()) {
            return new SearchViewState.EmptyResult(searchString);
          } else {
            return new SearchViewState.SearchResult(searchString, products);
          }
        })
        .startWith(new SearchViewState.Loading())
        .onErrorReturn(error -> new SearchViewState.Error(searchString, error));
  }
838158
public <T> List<T> search(Class<T> managedClass, Name base, String filter, SearchControls scope) {
        Filter searchFilter = null;
        if(StringUtils.hasText(filter)) {
            searchFilter = new HardcodedFilter(filter);
        }

        return ldapTemplate.find(base, searchFilter, scope, managedClass);
    }
657754
@Override
  public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
    classInfo.checkTypeQueryAnnotation(desc);
    return super.visitAnnotation(desc, visible);
  }
642732
protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) {
		final String methodName = "newFeatureMapJSResourceFactory"; //$NON-NLS-1$
		boolean traceLogging = log.isLoggable(Level.FINER);
		if (traceLogging) {
			log.entering(sourceClass, methodName, new Object[]{resourceUri});
		}
		FeatureListResourceFactory factory = new FeatureListResourceFactory(resourceUri);
		if (traceLogging) {
			log.exiting(sourceClass, methodName);
		}
		return factory;
	}