Query Optimization - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

A query is composed of several types of predicates that can be optimized: full text and filtering.

For indexes generated starting from AFS v7.8, it is possible to optimize search queries by automatically sorting the filter in their most efficient order in the query, based on previously analyzed data.

Query optimization can be activated by default or added in the request. The optimization level in the request overloads the one put by default.

The following boolean parameter is used:

afs:O[0|1|2]

  • afs:O0 (Optimization legacy level)

    Within each "a b c" full-text predicate, the browsing of full-text index's structures is optimized by searching words starting with the less frequent ones in the corpus.

    Example: If "a" is used 1,000 times in the corpus, "b" 10 times and "c" 100 times, words are searched in the following order: "b", "c" then "a".

  • afs:O1 (Optimization level 1)

    Same as afs:o0 PLUS all filtering predicates are sorted in such order the filters returning the fewer results are applied first.

    Example: Considering the following: "facet1=a" returns 100 documents and "facet2=b" returns 10 documents. "facet2=b" is applied first to reduce the result to 10 documents, then "facet1=a" is applied on these 10 documents.

  • afs:O2 (Optimization level 2)

    Same as afs:O1 PLUS full-text predicates are integrated.

    Example: Considering the following: "facet1=a" returns 100 documents and "facet2=b" returns 10 documents AND full-text predicate returns 50 documents. "facet2=b" is applied first to reduce the result to 10 documents, then the full-text predicate is applied on these 10 documents and finally "facet1=a" is applied on the remaining n documents.

This parameter only works if the reply bases have been generated by an Indexer in AFS v7.8.