prior - Fluid Topics

AFS Taruqa

Technical Notes

In general, facets serve to filter documents. With Taruqa, facets can also be used as parameters that dynamically rank results based on preferences at query time.

Facets can be taken into account the same way as a word in a document; a facet value can be a query criterion. Taruqa is able to combine word preferences with facet preferences and consider both as attributes with a computable probability score.

Any number of attributes can be added, and the model remains stable.

The prior (_prio_rity _or_dering) promotes documents by giving them priority over other documents.

The JSON object representing this operation follows this format:

{"prior": {"facet": "<facet_name>", 
           "value": "facet_value",
           "smoothing": {...}}}


  • facet_name is the facet to be used for ordering;

  • facet_value is the facet value to be prioritized. This value is optional. If it is not specified, documents with higher values for facet_name will be considered more relevant by this operator.

  • smoothing (optional). See the smoothing documentation.


  • afs:taruqa={"prior": {"facet": "Version", "value": "3.8"}}: this query prioritizes the documents tagged with Version:3.8 over the documents tagged with other versions.

  • afs:taruqa={"prior": {"facet": "Category"}}: this query prioritizes the documents tagged with a Category, no matter what value is set. When no value is mentioned, the priority goes to:

  • true for a boolean facet;
  • Highest values for an integer or real facet;
  • Natural ordering for a string facet. This should work to prioritize the latest version when the string facet values represent a version. For example, "Application V3.15.2" will have priority over "Application V3.10.2".

The Taruqa syntax is compliant with the AFS legacy afs:filter parameter. As a result, the following query keeps only Screencasts documents:

afs:taruqa={"combine": [{"terms": {"query": "Pretty URL"}}]}&afs:filter=Type="Screencasts"

Meanwhile, the following query gives preference to Screencasts documents.

afs:taruqa={"combine": [{"terms": {"query": "Pretty URL"}},
                        {"prior": {"facet": "Type", "value": "Screencasts"}}]}