Skip to content
romanchyla edited this page Nov 3, 2013 · 1 revision

Search Syntax

The ADS2.0 search engine has a very powerful query language. We do not advertise all the features of the system to the users, but if you writing your applications using API, you may want to get yourself familiar with the details.

The Standard (Boring) Features

You want to query a specific indexes, because unfielded search is very broad (#see unfielded-search). The format is:

indexname : value

Examples

title:x-ray title:"x-ray" title:(x-ray)

ADS2.0 supports Boolean logic, so you can combine tokens using operators AND, OR, NOT, examples:

title:x-ray AND keyword:chandra title:x-ray OR keyword:chandra title:x-ray NOT keyword:chandra

If all values are inside one index, we also allow the following syntactic sugar:

title:(x-ray OR chandra)

The query above is equivalent to "title:x-ray OR title:chandra" -- it just saves you some typing, usually when you want to send a list of bibcodes, eg.

keyword:(a OR b OR c OR d OR)

Unfielded searches

You SHOULD know that if you do not specify an index, we are going to do some black magic with your search. Let's start with simple examples:

black holes

This innocuous query will be changed drastically. We'll search different fields, apply various boost factors and we take the liberty of searching for both words separately, AS WELL as phrase, and we'll apply default operator.

example parsed example

To explain what happened:

  1. our default operator is AND, so we'll search for +black +holes
  2. we'll also search for the phrase "black holes"
  3. we'll search different indexes: title, keyword, fulltext and few others
  4. we'll give each index different boost factor (i.e. we favor matches from title over fulltext)

And we do not guarantee that if your search worked last week, it will be the same today. In other words, we may change the logic from day to day, depending on what we think works best for our normal users.

The best strategy, if you want to be sure, your query works properly, is to add the '''debugQuery''' paramter. Try the following query:

q=t'+hooft+normalization&debugQuery=true

You should see the following output at the end of the request. The most important part is '''parsed_query'''

This shows you exactly what the search engine will look for as it executes the query. And sometimes you may be surprised, look at the author part, or try the following examples:

hubble space telescope calibration (this should be overlaping) hubble space telescope AND chandra "hubble space telescope AND chandra"