Get Spotify catalog information about albums that match a keyword string.

@param q The search query's keywords (and optional field filters and operators).
@return A {@link SearchAlbumsRequest.Builder}.
976014
public SearchAlbumsRequest.Builder searchAlbums(String q) {
    return new SearchAlbumsRequest.Builder(accessToken)
            .setDefaults(httpManager, scheme, host, port)
            .q(q);
  }
272123
public function query($q = null)
    {
        return Product::where(function ($query) use ($q) {
                if ($q) {
                    foreach (explode(' ', $q) as $keyword) {
                        $query->where('description', 'like', "%{$keyword}%");
                    }
                }
            })
            ->orderBy('description')
            ->paginate();
    }
127855
public Track getMatchingTrack(String q_track, String q_artist)
			throws MusixMatchException {
		Track track = new Track();
		Map<String, Object> params = new HashMap<String, Object>();

		params.put(Constants.API_KEY, apiKey);
		params.put(Constants.QUERY_TRACK, q_track);
		params.put(Constants.QUERY_ARTIST, q_artist);

		track = getTrackResponse(Methods.MATCHER_TRACK_GET, params);

		return track;
	}
642745
public Collection<NrqlAlertCondition> list(List<String> queryParams)
    {
        return HTTP.GET("/v2/alerts_nrql_conditions.json", null, queryParams, NRQL_ALERT_CONDITIONS).get();
    }
1099899
public SearchRequestBuilder getSearchRequestBuilder(QueryBuilder
            queryBuilder, String... indices) {
        return getSearchRequestBuilder(indices, null, queryBuilder);
    }
507569
@Override
    public Map<String, FieldTypes> get(final Collection<String> fieldNames, Collection<String> indexNames) {
        // Shortcut - if we don't select any fields we don't have to do any database query
        if (fieldNames.isEmpty()) {
            return Collections.emptyMap();
        }

        // We have to transform the field type database entries to make them usable for the user.
        //
        // [
        //   {
        //     "index_name": "graylog_0",
        //     "fields": [
        //       {"field_name": "message", "physical_type": "text"},
        //       {"field_name": "source", "physical_type": "keyword"}
        //     ]
        //   },
        //   {
        //     "index_name": "graylog_1",
        //     "fields": [
        //       {"field_name": "message", "physical_type": "text"},
        //     ]
        //   }
        // ]
        //
        // gets transformed into
        //
        // {
        //   "message": {
        //     "field_name": "message",
        //     "types": [
        //       {
        //         "type": "string",
        //         "properties": ["full-text-search"],
        //         "index_names": ["graylog_0", "graylog_1"]
        //     ]
        //   },
        //   "source": {
        //     "field_name": "source",
        //     "types": [
        //       {
        //         "type": "string",
        //         "properties": ["enumerable"],
        //         "index_names": ["graylog_0"]
        //     ]
        //   }
        // }

        // field-name -> {physical-type -> [index-name, ...]}
        final Map<String, SetMultimap<String, String>> fields = new HashMap<>();

        // Convert the data from the database to be indexed by field name and physical type
        getTypesStream(fieldNames, indexNames).forEach(types -> {
            final String indexName = types.indexName();

            types.fields().forEach(fieldType -> {
                final String fieldName = fieldType.fieldName();
                final String physicalType = fieldType.physicalType();

                if (fieldNames.contains(fieldName)) {
                    if (indexNames.isEmpty() || indexNames.contains(indexName)) {
                        if (!fields.containsKey(fieldName)) {
                            fields.put(fieldName, HashMultimap.create());
                        }
                        fields.get(fieldName).put(physicalType, indexName);
                    }
                }
            });
        });

        final ImmutableMap.Builder<String, FieldTypes> result = ImmutableMap.builder();

        for (Map.Entry<String, SetMultimap<String, String>> fieldNameEntry : fields.entrySet()) {
            final String fieldName = fieldNameEntry.getKey();
            final Map<String, Collection<String>> physicalTypes = fieldNameEntry.getValue().asMap();

            // Use the field type mapper to do the conversion between the Elasticsearch type and our logical type
            final Set<FieldTypes.Type> types = physicalTypes.entrySet().stream()
                    .map(entry -> {
                        final String physicalType = entry.getKey();
                        final Set<String> indices = ImmutableSet.copyOf(entry.getValue());

                        return typeMapper.mapType(physicalType).map(t -> t.withIndexNames(indices));
                    })
                    .filter(Optional::isPresent)
                    .map(Optional::get)
                    .collect(Collectors.toSet());

            result.put(fieldName, FieldTypes.create(fieldName, types));
        }

        return result.build();
    }
381095
public ArrayList<OvhTelephonySearchService> searchServices_GET(String axiom) throws IOException {
		String qPath = "/telephony/searchServices";
		StringBuilder sb = path(qPath);
		query(sb, "axiom", axiom);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t20);
	}
588072
public SearchTracksRequest.Builder searchTracks(String q) {
    return new SearchTracksRequest.Builder(accessToken)
            .setDefaults(httpManager, scheme, host, port)
            .q(q);
  }
59008
public SearchCriterion getSearchCriterion() {
		Object operator = operatorSelect.getValue();
		Object value = valueItem.getValue();

		if (selectedAttribute != null && operator != null) {
			String operatorString = getOperatorCodeFromLabel(operator.toString());
			String valueString = "";
			String nameString = selectedAttribute.getName();
			
			if (value != null) {
				valueString = value.toString();
			}

			// CQL does not recognize "contains", so change to "like":
			if ("contains".equals(operatorString)) {
				operatorString = "LIKE";
				valueString = CQL_WILDCARD + valueString + CQL_WILDCARD;
			}

			// If value was null, and no "contains" operator, return null:
			if (valueString == null || valueString.length() == 0) {
				return null;
			}

			if (selectedAttribute instanceof PrimitiveAttributeInfo) {
				PrimitiveAttributeInfo attr = (PrimitiveAttributeInfo) selectedAttribute;

				if (attr.getType().equals(PrimitiveType.STRING) || attr.getType().equals(PrimitiveType.IMGURL)
						|| attr.getType().equals(PrimitiveType.URL)) {
					// In case of a string, add quotes:
					valueString = "'" + valueString + "'";

				} else if (attr.getType().equals(PrimitiveType.DATE)) {
					if (value instanceof Date) {
						// In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z
						DateTimeFormat format = DateTimeFormat.getFormat(CQL_TIME_FORMAT);

						if ("=".equals(operatorString)) {
							// Date equals not supported by CQL, so we use the DURING operator instead:
							operatorString = "DURING";
							Date date1 = (Date) value;
							Date date2 = new Date(date1.getTime() + 86400000); // total milliseconds in a day
							valueString = format.format(date1) + "/" + format.format(date2);
						} else {
							// format the date:
							valueString = format.format((Date) value);
						}
					}
				}
			} else if (selectedAttribute instanceof AssociationAttributeInfo) {
				AssociationAttributeInfo assInfo = (AssociationAttributeInfo) selectedAttribute;
				if (AssociationType.MANY_TO_ONE == assInfo.getType()) {
					nameString = nameString + ID_SUFFIX;
				}
			}

			// Now create the criterion:
			SearchCriterion criterion = new SearchCriterion();
			criterion.setAttributeName(nameString);
			criterion.setOperator(operatorString);
			criterion.setValue(valueString);
			return criterion;
		}
		return null;
	}
1008060
def getSearchUrl(self, album, artist):
    
    url = "%s/search" % (__class__.BASE_URL)
    params = collections.OrderedDict()
    params["search-alias"] = "digital-music"
    params["field-keywords"] = " ".join((artist, album))
    params["sort"] = "relevancerank"
    return __class__.assembleUrl(url, params)
886255
public static appqoecustomresp[] get_filtered(nitro_service service, String filter) throws Exception{
		appqoecustomresp obj = new appqoecustomresp();
		options option = new options();
		option.set_filter(filter);
		appqoecustomresp[] response = (appqoecustomresp[]) obj.getfiltered(service, option);
		return response;
	}
840750
public List<CmsSearchResult> getSearchResult() {

        if ((m_cms != null)
            && (m_result == null)
            && (m_parameters.getIndex() != null)
            && (m_parameters.isIgnoreQuery()
                || CmsStringUtil.isNotEmpty(m_parameters.getQuery())
                || CmsStringUtil.isNotEmpty(m_parameters.getParsedQuery())
                || (m_parameters.getFieldQueries() != null))) {

            if (!m_parameters.isIgnoreQuery()
                && CmsStringUtil.isEmpty(m_parameters.getParsedQuery())
                && (getQueryLength() > 0)) {

                if (m_parameters.getFieldQueries() != null) {
                    // check all field queries if the length of the query is ok
                    for (CmsSearchParameters.CmsSearchFieldQuery fq : m_parameters.getFieldQueries()) {
                        for (String keyword : fq.getSearchTerms()) {
                            if (CmsStringUtil.isEmpty(keyword) || (keyword.trim().length() < getQueryLength())) {

                                m_lastException = new CmsSearchException(
                                    Messages.get().container(
                                        Messages.ERR_QUERY_TOO_SHORT_1,
                                        new Integer(getQueryLength())));

                                return null;
                            }
                        }
                    }

                } else if (m_parameters.getQuery().trim().length() < getQueryLength()) {

                    m_lastException = new CmsSearchException(
                        Messages.get().container(Messages.ERR_QUERY_TOO_SHORT_1, new Integer(getQueryLength())));

                    return null;
                }
            }

            try {

                CmsSearchResultList result = m_parameters.getSearchIndex().search(m_cms, getParameters());

                if (result.size() > 0) {

                    m_result = result;
                    m_searchResultCount = result.getHitCount();
                    m_categoriesFound = result.getCategories();

                    // re-caluclate the number of pages for this search result
                    m_pageCount = m_searchResultCount / m_parameters.getMatchesPerPage();
                    if ((m_searchResultCount % m_parameters.getMatchesPerPage()) != 0) {
                        m_pageCount++;
                    }

                    // re-calculate the URLs to browse forward and backward in the search result
                    String url = m_cms.getRequestContext().getUri() + m_parameters.toQueryString() + "&searchPage=";
                    if (m_parameters.getSearchPage() > 1) {
                        m_prevUrl = url + (m_parameters.getSearchPage() - 1);
                    }
                    if (m_parameters.getSearchPage() < m_pageCount) {
                        m_nextUrl = url + (m_parameters.getSearchPage() + 1);
                    }
                } else {
                    m_result = Collections.emptyList();
                    m_searchResultCount = 0;
                    m_categoriesFound = null;
                    m_pageCount = 0;
                    m_prevUrl = null;
                    m_nextUrl = null;
                }
            } catch (Exception exc) {

                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_SEARCHING_FAILED_0), exc);
                }

                m_result = null;
                m_searchResultCount = 0;
                m_pageCount = 0;

                m_lastException = exc;
            }
        }

        return m_result;
    }
226164
function searchTrack_q(options) {
    return new Promise(function (resolve, reject) {
        if (!options.oauth_token) {
            reject(new Error('Error searchTrack_q oauth_token is required and is null '));
        } else {

            if (!options.q) {
                reject(new Error('Error searchTrack_q options.q is required and is null'));
            } else {
                var uri = 'https://api.soundcloud.com/me/tracks?format=json&oauth_token=' + options.oauth_token + '&q=' + options.q;
                if (DEBUG_MODE_ON) {
                    console.log("searchTrack_q URI, ", uri);
                }

                request.getAsync(uri, {timeout: 10000}).spread(function (response, body) {
                    //console.log('searchTrack_q successful',body);
                    try {
                        //console.log(body.toString('utf8'))
                        resolve(JSON.parse(body.toString('utf8')));
                    } catch (e) {
                        if (DEBUG_MODE_ON) {
                            console.log('Error while searchTrack_q track: ', e);
                        }
                        reject(e);
                    }
                }).catch(function (e) {
                    if (DEBUG_MODE_ON) {
                        console.log('Error while searchTrack_q track: ', e);
                    }
                    reject(e);
                });
            }
        }
    });
}
746436
@Override
  public MtasSpanQuery getQuery() throws ParseException {
    MtasSpanQuery q = null;
    // match any word (try to avoid...)
    if (wordCondition.isEmpty()) {
      q = new MtasSpanMatchAllQuery(wordCondition.field());
      // only positive queries
    } else if (wordCondition.isSimplePositive()) {
      if (wordCondition.isSingle()) {
        q = wordCondition.getPositiveQuery(0);
      } else {
        if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
          q = new MtasSpanAndQuery(wordCondition.getPositiveQuery().toArray(
              new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        } else if (wordCondition.type()
            .equals(MtasCQLParserWordCondition.TYPE_OR)) {
          q = new MtasSpanOrQuery(wordCondition.getPositiveQuery().toArray(
              new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        } else {
          throw new ParseException("unknown type " + wordCondition.type());
        }
      }
      // only negative queries
    } else if (wordCondition.isSimpleNegative()) {
      throw new ParseException("shouldn't be simple negative");
      // both positive and negative queries
    } else {
      if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
        MtasSpanQuery qPositive;
        MtasSpanQuery qNegative;
        if (wordCondition.getPositiveQuery().size() == 1) {
          qPositive = wordCondition.getPositiveQuery(0);
        } else {
          qPositive = new MtasSpanAndQuery(
              wordCondition.getPositiveQuery().toArray(
                  new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        }
        if (wordCondition.getNegativeQuery().size() == 1) {
          qNegative = wordCondition.getNegativeQuery(0);
        } else {
          qNegative = new MtasSpanOrQuery(
              wordCondition.getNegativeQuery().toArray(
                  new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
        }
        q = new MtasSpanNotQuery(qPositive, qNegative);
      } else if (wordCondition.type()
          .equals(MtasCQLParserWordCondition.TYPE_OR)) {
        MtasSpanQuery qPositive;
        MtasSpanQuery qNegative;
        if (wordCondition.getPositiveQuery().size() == 1) {
          qPositive = wordCondition.getPositiveQuery(0);
        } else {
          qPositive = new MtasSpanOrQuery(
              wordCondition.getPositiveQuery().toArray(
                  new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        }
        if (wordCondition.getNegativeQuery().size() == 1) {
          qNegative = wordCondition.getNegativeQuery(0);
        } else {
          qNegative = new MtasSpanAndQuery(
              wordCondition.getNegativeQuery().toArray(
                  new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
        }
        q = new MtasSpanNotQuery(qPositive, qNegative);
      } else {
        throw new ParseException("unknown type " + wordCondition.type());
      }
    }
    if (not) {
      MtasSpanQuery qPositive = new MtasSpanMatchAllQuery(
          wordCondition.field());
      q = new MtasSpanNotQuery(qPositive, q);
    }
    return q;
  }
1138359
public List<FogbugzCase> searchForCases(String query) throws InvalidResponseException, NoSuchCaseException {
        HashMap<String, String> params = new HashMap<String, String>();  // Hashmap defaults to <String, String>
        params.put("cmd", "search");
        params.put("q", query);
        params.put("cols", "ixBug,tags,fOpen,sTitle,sFixFor,ixPersonOpenedBy,ixPersonAssignedTo" + // No trailing comma
                this.getCustomFieldsCSV());

        Document doc = null;
        try {
            doc = this.getFogbugzDocument(params);
        } catch (Exception e) {
            throw new InvalidResponseException(e.getMessage());
        }

        // Check for case count in cases tag, so we know wheter to parse the response ever further or not.
        int caseCount = 0;
        try {
            Node casesContainer = doc.getElementsByTagName("cases").item(0);
            caseCount = Integer.parseInt(casesContainer.getAttributes().getNamedItem("count").getTextContent());
        } catch (NumberFormatException e) {
            log.log(Level.INFO, "No valid number in case count XML response.", e);
        }
        if (caseCount < 1) {
            throw new NoSuchCaseException("Fogbugz did not return a case for query id " + query);
        }

        NodeList caseNodes = doc.getElementsByTagName("case");
        ArrayList<FogbugzCase> caseList = new ArrayList<FogbugzCase>();
        for (int i = 0; i < caseNodes.getLength(); i++) {
            caseList.add(this.constructCaseFromXmlNode(caseNodes.item(i)));
        }
        return caseList;
    }
849811
def search(self):
        
        results = self.index.objects.all()
        # reduce the results based on the q field
        if self.cleaned_data.get("q"):
            results = results.query(
                "multi_match",
                query=self.cleaned_data['q'],
                fields=self.get_fields(),
                # this prevents ES from erroring out when a string is used on a
                # number field (for example)
                lenient=True
            )

        return results
244103
def search(type, query)
      results = []
      search = request('getResultsFromSearch', type: type, query: query)
      results = search['result'].map do |data|
        next Song.new data if type == 'Songs'
        next Playlist.new(self, data) if type == 'Playlists'
        data
      end if search.key?('result')
      results
    end