Skip to main content

In this article, we’ll delve into the significance of “q”, “qInTitle”, and “qInMeta” Advanced Search parameters, exploring how they help users to extract precise and narrowed news data.

Before we indulge ourselves in learning about the q, qInTitle and qInMeta parameters, it is important to know where and how you can search content related to your topic.

The Search bar inserted below can be used to fetch data related to the query of your choice.

(Search Bar)

 

The search bar inserted here can be found on the dashboard of the Newsdata.io, and can be accessed to fetch data as well as get data on the number of articles available from previous 48 hours related to the given query.

What are the q, qInTitle, and qInMeta parameters?

The “q”, “qInTitle”, and “qInMeta” parameters are exclusive features of NewsData.io’s Advanced Search function. They are designed to enhance the quality of your searches and enable you to retrieve articles that are directly related to your specified keywords.

1. q

The “q” parameter is short for the query. You can enter your keyword or phrase in the q parameter, and the API will retrieve all those articles containing that keyword or phrase in the title, URL, meta description, or meta keywords anywhere in the articles.

The request parameter ‘q=Messi’, will fetch you all articles related to the given query.

2. qInTitle

The “qInTitle” parameter is short for “query in title.”. It is designed specifically to fetch those articles that contain the keyword/phrase in the title only.
The qInTitle parameter doesn’t search for the given keyword in the URL, meta description, or meta keywords of the articles. This helps narrow down the search results, ensuring that the retrieved articles are more relevant to your searched keyword/phrase.

The request parameter ‘qInTitle=Messi’, will fetch you all articles with the keyword in their title.

3. qInMeta

The “qInMeta” parameter is short for “query in meta.”. This will help you fetch those articles that contain the given keyword or phrase in the title, URL, meta description, or meta keywords.

The request parameter ‘qInMeta=Messi’, will fetch you articles with the given keyword in their title, URL, meta description, and whole content.

NOTE: You can’t use the ‘q’, ‘qInTitle’, and ‘qInMeta’ simultaneously in a single query.

Use cases of q, qInTitle, and qInMeta 

Let’s understand how q, qInTitle, and qInMeta work with the help of an example.

Let’s consider that you are looking for articles related to Messi.

Use Case: ‘q’ parameter

The ‘q’ or ‘query’ parameter is useful when you want to search and retrieve articles related to a specific keyword or phrase.

To help understand better, we will use the above-mentioned example.

  • If you want to fetch articles related to Messi, then the keyword would be “Messi.”.
  • The request parameter for this query would be ‘q=Messi’.

Use Case: ‘qInTitle’ parameter

The ‘qInTitle’ or ‘query in the title’ parameter is useful in conditions where the user wants specific news related to that query rather than getting irrelevant news.

To help understand better, we will use the above-mentioned example.

  • If you want to fetch articles related to Messi in titles only, then the keyword would be “Messi.”.
  • The request parameter for this query would be ‘qInTitle=Messi’.

By using the ‘qInTitle’ parameter, you would get specific articles related to the given query and would end up saving your credits.

Use Case: ‘qInMeta’ parameter

The ‘qInMeta’ or ‘query in meta’ parameter is useful if a user wants to search for data which should contain the given keyword in the URL, Title, Meta Keywords, and Meta description only. This will help you find descriptive data and retrieve a more relevant and less bulky number of articles.

To help understand better, we will use the above-mentioned example.

  • If you want to fetch articles related to Messi, then the keyword would be “Messi”.
  • The request parameter for fetching articles with a given keyword in the title, URL, meta keywords, and meta description would be ‘qInMeta=Messi’.

How to use the q, qInTitle, and qInMeta parameters?

  1. First, determine the keyword you want to target and fetch articles about.
  2. When making an API request, include the “q”, “qInTitle”, and “qInMeta” parameters along with your chosen keywords.
  3. The API will then return articles that match your specified criteria. This precision ensures you only receive articles that directly relate to your chosen keywords to retrieve articles that mention this topic in their URLs, titles, meta keywords, and meta descriptions.

Quick Tips and Tricks

  • For a single keyphrase, your parameter would be ‘q=football’ or ‘qintitle=Messi’.
  • If you are looking for articles that contain exact phrases, then you need to put the phrase between double quotes (“ “).

For example, q=“global warming”.

  • If you want to search for multiple keywords present in each news article but not necessarily together, then either write all the keywords separated by a space or put the ‘AND’ operator between those keywords.
    For example,

You can use ‘q=movie AND marvel’ or ‘q=movie marvel’, to search all the articles having both movie and marvel keywords anywhere in the title, URL, meta description, and content.

These keywords may or may not be present in those articles together.

  • For searching those articles that should exclude some terms, you can use the ‘NOT’ operator after the keyword.

For Example,

If you want to fetch articles related to Global warming but not from the USA, then you can use  q= “global warming” NOT (USA).

This query will show those articles that contain the term global warming and exclude all those articles that contain the term USA.

  • For searching for one keyword and excluding multiple keywords, you can use ‘q=social NOT (pizza AND wildfire)’.

https://newsdata.io/api/1/news?apikey=pub_YOUR_API_KEY&q=social NOT (pizza AND wildfire)

This will exclude all those articles which contain ‘pizza’ and ‘wildfire’.

  • For searching for any one keyword among the two options, you can use the ‘OR’ operator.

For Example, ‘q=pizza OR pasta’, will retrieve those articles which contain pizza or pasta in the entire content.

If you want this keyword to be specifically mentioned in the title, then change the q to qInTitle.

  • For searching any one of the keywords between two keywords, excluding one keyword, you use ‘OR’ AND ‘NOT’ operators simultaneously.

For example, if  q=(pizza OR pasta) NOT global, this query will retrieve the article that contains the term pizza or pasta but won’t contain the term global.

  • To exclude the specific phrase rather than the keyword, the request parameter would be q=oscars NOT (“best actor”)

NOTE: The maximum character limit for a single query (“q” and “qInTitle”) is 512 characters. If the number of characters exceeds this limit, the API will show an error.

NOTE: The operators AND, OR, and NOT, as well as brackets, spaces, and quotes, are included in the character count.

This is the maximum character limit of a query that one can use to search for and retrieve data.

https://newsdata.io/api/1/news?apikey=pub_YOUR_API_KEY&q=world OR UNESCO OR NATO OR USA OR BRICS OR meetings OR global OR INTERNATIONAL OR universal OR globally OR multinational NOT (war OR peace OR guns OR politics OR food OR fashion OR G20 OR debate OR russia OR pakistan OR deaths OR money OR GDP OR LGBTQ OR Racism OR music OR movies OR influencers OR concerts OR strike OR aliens OR killing OR illegal OR cryptocurrency OR internet OR climate OR UFO OR cartoons OR cars OR bitcoin OR flood OR earthquake OR strike OR accidents OR japan) AND mountains AND ocean

Benefits of the q, qlnTitle, and qInMeta parameters

  • Relevance

By utilizing these parameters, you ensure that the articles you receive are directly related to your chosen keywords, minimizing noise and maximizing relevance.

  • Focused Insights

Whether you’re researching a specific event, tracking trends, or staying updated on a particular topic, “q” and “qInTitle” filters provide focused insights that align with your interests.

  • Efficiency

These parameters streamline the process of finding information by allowing you to filter out articles that don’t match your criteria.

  • Efficient Credit Consumption

These parameters help ensure minimal credit consumption by enabling you to specify the articles you want to fetch. You can also fetch articles that contain the given keyword/phrase in a particular part (i.e., the title, URL, or the whole content).

Difference Between q, qInTitle, and qInMeta


Basis

q

qInTitle

qInMeta
News extraction pointsq will extract news that contains keywords on Title, Content, URL, and DescriptionqInTitle will only extract news that contains keywords in Title only.qInMeta will extract news that contains keywords in Title, URL, and Meta Description.
queryhttps://newsdata.io/api/1/news?apikey=pub_YOU API KEY&q=spiderhttps://newsdata.io/api/1/news?apikey=pub_YOU API KEY&qInTitle=spiderhttps://newsdata.io/api/1/news?apikey=pub_YOU API KEY&qInMeta=spider
SuitabilitySuitable for those users who want to fetch articles based on their keyword or phrase choice present anywhere in the article.Suitable for those users who want to fetch articles based on their keyword/phrase choice as presented in the titles only.Suitable for those users who want to fetch articles based on their keyword or phrase choice present in the meta keywords, meta description, URL, or title.

Leave a Reply