Set QIE using a plugin

The plugin indexing interface provides two methods supplyQieByURL() and supplyQieByQuery() to assign Query Independent Evidence (QIE) to a given document or a list of documents returned by a query within a data source as part of a plugin’s functionality.

The primary use case for this is to assign a QIE weight to the given documents that are required to support a plugin.

Prerequisite

To assign a QIE weight to one or more URLs using a plugin, your plugin must be configured to provide indexing functionality.

Final QIE weight

QIE can be added from configuration (qie.cfg or query_qie.cfg) or via one or more plugins. It is a floating-point value, varying from 0 to 1. Each source of QIE weight is independent of the other sources.

The final QIE weight applied to a given document will be taken from a source in the following order if all of these sources assign a QIE weight to the same URL.

  • qie.cfg

  • supplyQieByURL()

  • query_qie.cfg

  • supplyQieByQuery()

If none of the above sources provided a QIE to a given document, a default QIE weight (i.e., 0.5) would be assigned.

Set QIE on a document

This is equivalent to QIE weights that are defined in qie.cfg. But it will have a lower QIE weight assignment priority than qie.cfg.

To set a QIE based on a URL match, implement the supplyQieByURL() method within this java class.

void supplyQieByURL(IndexConfigProviderContext context, QieByUrlConsumer consumer)

Within this method, you need to call the applyQieWhenUrlMatches() method on the consumer for each QIE assignment to the URL you wish to set up.

The void applyQieWhenUrlMatches(double qieWeight, String url) method takes two parameters:

qieWeight

The QIE weight to set. This must be a valid floating point value between 0 and 1. See: configuring QIE. If an invalid value is assigned, it will throw an illegal argument exception.

url

A string for the URL whose QIE is to be set.

Set QIE on documents returned by a Funnelback query

This is equivalent to QIE weights that are defined in query_qie.cfg. But it will have a lower QIE weight assignment priority than query_qie.cfg.

To set a QIE weight based on a match to a Funnelback query, implement the supplyQieByQuery() method within this Java class.

void supplyQieByQuery(IndexConfigProviderContext context, QieByQueryConsumer consumer)

Within this method, you need to call the applyQieWhenQueryMatches() method on the consumer for each mapping you wish to set up.

The void applyQieWhenQueryMatches(double qieWeight, String query) method takes two parameters:

qieWeight

The QIE weight to set. This must be a valid floating point value between 0 and 1. See: configuring QIE. If an invalid value is assigned, it will throw an illegal argument exception.

query

The Funnelback search query which will be run. The search query must be specified using the Funnelback query language and will be run against the search index of the data source.

Example: Set QIE weights

This example demonstrates how to set QIE weight on a document using a plugin.

ExampleIndexingConfigProvider.java
package com.funnelback.plugin.example;

import com.funnelback.plugin.index.consumers.QieByUrlConsumer;
import com.funnelback.plugin.index.consumers.QieByQueryConsumer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.funnelback.plugin.index.IndexConfigProviderContext;
import com.funnelback.plugin.index.IndexingConfigProvider;

public class ExampleIndexingConfigProvider implements IndexingConfigProvider {

    private static final Logger log = LogManager.getLogger(ExampleIndexingConfigProvider.class);

    @Override
    public void supplyQieByURL(IndexConfigProviderContext context, QieByUrlConsumer consumer)  {
        log.debug("Set QIE weight for a URL");

        consumer.applyQieWhenUrlMatches(0.3, "www.example.com/documents");(1)
        consumer.applyQieWhenUrlMatches(0.45, "www.example.com/tests");(1)
    }

    @Override
    public void supplyQieByQuery(IndexConfigProviderContext context, QieByQueryConsumer consumer) {
        log.debug("Set QIE weight for a list of URL(s) returned from a query");

        consumer.applyQieWhenQueryMatches(0.3, "word document"); (2)
        consumer.applyQieWhenQueryMatches(0.45, "excel file"); (2)
    }
}
1 Sets the QIE weight of 0.3 on URL - www.example.com/documents and the QIE weight of 0.45 on URL - www.example.com/tests within the data source’s index. This is equivalent to you setting the following line in the qie.cfg:
0.3 www.example.com/documents
0.45 www.example.com/tests
2 Sets the QIE weight of 0.3 for all URLs that are returned for a query of word document and the QIE weight of 0.45 for all URLs that are returned for a query of excel file run against the data source’s index. This is equivalent to you setting the following line in the query-qie.cfg:
0.3 word document
0.45 excel file