> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lucidworks Fusion

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/app-studio/reference/search-platforms/fusion/overview

[old doc.lw link]: https//doc.lucidworks.com/app-studio/4.2/3200

[mintlify link]: https://doc.lucidworks.com/docs/4/app-studio/reference/search-platforms/fusion/overview

The Fusion search adapter brokers all communication with the [Lucidwork’s Fusion platform](https://lucidworks.com/products/fusion/) using its Apollo REST API to query Solr.

<LwTemplate />

## Setup

To add Fusion search connectors to a Maven project, you must add this dependency to your project’s `pom.xml` file:

```xml wrap  theme={"dark"}
<dependency>
    <groupId>twigkit</groupId>
    <artifactId>twigkit.fusion</artifactId>
    <version>${project.parent.version}</version>
</dependency>
```

## Usage

Assuming you have added the correct dependencies to your project (see above), the Fusion platform configuration can be accessed by pointing to it in the search:platform tag. In this case the platform is placed in a variable named `platform` using the `var` attribute, and points to a platform configuration in ../conf/platforms/fusion/search.conf:

```xml wrap  theme={"dark"}
<search:platform var="platform" conf="platforms.fusion.search"></search:platform>
```

### platforms/fusion/search.conf

In this example platform configuration, we set some general settings for the platform:

```yml wrap  theme={"dark"}
name: twigkit.search.fusion.Fusion
timeOut: 30000
resultIDField: id
highlight: true
defaultQuery: *:*
query-profile: my-profile
```

With a Fusion platform, we also need to set some additional parameters in the following files:

### services/api/fusion.conf

This file controls which Fusion server to use:

```yml wrap  theme={"dark"}
# Hostname of your Fusion server
host: myHostname

# Port of your Fusion server
port: 6764

# Protocol of your Fusion server - e.g. http or https
protocol: http

# Optional: Fusion Authorization mode - native, serviceaccount, or jwt.
#   If not configured, this will default to the first configured option in the order JWT > Service Account > Native
#   Native auth requires no config here, but does require the twigkit.security.provider.fusion module to be loaded.
# auth: native

# Service Account config
userName: admin
password: password

# JWT config
# issuer:
# key:
# groups:

# Optional: If a JWT subject is configured, all requests to Fusion will be sent as the JWT realm user whose name matches the subject
# subject:
```

### platforms/fusion/social.conf

This file configures the Lucidworks Appkit Social Module:

```yml wrap  theme={"dark"}
# For every Fusion App, a corresponding YOUR_FUSION_APP_user_prefs collection is automatically created.
# Appkit uses this collection for storing collaboration user-data.

# Name of the collection to store user data in
collection: Supp-Demo_user_prefs

# Name of the Query & Index pipelines to use - _system is the Fusion default
# pipeline: _system

# Enable writing new Social entities into the platform
readOnly: false

# Prevent users from searching this platform directly
webservice-enabled: false
```

### message/service/fusion.conf

This file configures how Signals are sent to Fusion:

```yml wrap  theme={"dark"}
# Fusion Signals config

# Name of the Query profile to send Signals through
query-profile: Supp-Demo

# The index pipeline to send Signals to
# signals-index-pipeline: _signals_ingest

# Whether to commit Signals to disk inside Fusion immediately or not
# commit: true

# Whether to index to Fusion asynchronously or not
# async: true
```

### Required attributes

`query-profile (java.lang.String)`\
The Fusion query profile being accessed. If you have created an app via the Fusion UI called MyAwesomeApp, then you will have a default Query Profile called MyAwesomeApp as well - this is a good starting point.\
Applied in: configuration

### Optional attributes

`requestHandler (java.lang.String)`\
Name of the Request Handler to use. Use this to specify an alternate Request Handler to use for example, the '/dismax' request handler. Note you can override this by specifying a 'custom' attribute on the query.

`requestMethod (java.lang.String)`\
Which HTTP request method to use (GET or POST).

`strategy (java.lang.String)`\
Whether to cluster multiple hosts (value should be either combine, or round-robin). To enable sharding, set strategy to combine.

`groupField (java.lang.String)`\
Setting this enables Solr Result Grouping or Field Collapsing on the given field.
This will create a Result for each Group returned. Matching documents for the group will be available as related results.

`timeOut (java.lang.Integer)`\
Time out for platform query requests (in milliseconds).\
Default: 5000

`ignoreAppliedFilters (java.lang.Boolean)`\
If this is set to false, facet filters that have already been applied to the Query are added to the list of filters for the facet.\
Default: true

`backwardsCompatible (java.lang.Boolean)`\
For Solr 1.x (for example, 1.4) set backwardsCompatible to true.\
Default: false

`highlight (java.lang.Boolean)`\
Whether to enable hit highlighting (hl parameter) in Solr.\
Default: true

### Attributes shared across platforms

`aliases (java.lang.String)`\
Manage mappings from field names to aliases (use a comma-separated list). All references to the field (via this platform) in results, facets, filters, and query strings are mapped. For example, to refer to a field in the index named `firstnamelastname` as `name` and `countryofresidence` as `country`, use these mappings: `aliases="firstnamelastname=name,countryofresidence=country"`

`defaultQuery (java.lang.String)`\
Default query to use when none is specified. For Solr use `:` to bring back all items (for example, for 'zero term search').

`defaultFacets (java.lang.String)`\
Default facets to request when none are specified. This is a comma separated list.

`spellCheck (java.lang.Boolean)`\
Spellcheck the Query term if supported by the Platform.\
Default: `true`

`expandQuery (java.lang.Boolean)`\
Apply advanced linguistics such as stemming or lemmatization if supported by the Platform.\
Default: `true`

`autoCorrect (java.lang.Boolean)`\
Whether to auto-correct and resubmit futile queries (queries with zero results).\
Default: `true`

`fileTypeField (java.lang.String)`\
Set which field contains information about file type (mime type).\
Applied in: configuration

`resultIDField (java.lang.String)`\
Set which field represents the unique identifier for a given result. Should correspond to the \<uniqueKey> element in the Solr schema.xml.\
Applied in: JSP tag, configuration

`pageLimit (java.lang.Long)`\
A limitation to which page the platform will offset.\
Applied in: JSP tag, configuration

## Hit highlighting

Hit highlighting is enabled by default, and assumes that the unique uniqueKey field in the Solr `schema.xml` file is named id. If your uniqueKey is set to a different field highlighting will not work unless you set the resultIDfield key in the Appkit configuration to the right field.

```yml wrap  theme={"dark"}
resultIDField = yourUniqueKey
```

Appkit expects that Solr’s default highlighting tags of `<em></em>` are used. Ensure that this has not been set to something different using `hl.simple.pre` and `hl.simple.post` settings in the Solr or request handler configurations.

## Learn more

<AccordionGroup>
  <Accordion title="Fusion Impersonation via a Service Account">
    To securely access Fusion via Appkit, a user has several options. They can either adopt Appkit’s Fusion security provider making use of session cookies to send repeated requests back to Fusion, or they can access Fusion via a service account if they are planning to use [query pipelines](/api-reference/query-pipelines-api/get-all-query-pipelines). In this section, we describe how to set up the latter.

    ## 1 Set up a service account on the Fusion server

    If a user wants to query Fusion through a pipeline by impersonating another user via a service account, they must first ensure such an account has been set up on the Fusion server. This account should have access rights to the required resources.

    ## 2 Add Security Trimming query stages to required pipelines

    Query pipelines can have additional security filtering applied to ensure specific users do or do not have access to specific resources. This filtering can be set up by adding a Security Trimming stage to the query pipeline via the Fusion UI. The User ID key that is used in the security trimming stage to filter on results is supported in Appkit via the `user-id` attribute, which is described in the next section.

    ## 3 Update fusion.conf

    To query Fusion using this approach, this attributes must be added to the platform `fusion.conf` file in `src/main/resources/conf/platforms/fusion/`:

    ```yaml theme={"dark"}
    impersonate: true
    userName: joebloggs
    password: password
    user-id: username
    ```

    Here, the `impersonate` attribute informs Appkit that users will be querying Fusion pipelines via a service account. Below that, both the `userName` and the `password` are the credentials for the service account that Fusion will authenticate against. The last attribute `user-id` is optional and by default takes the value of `username`. This is the parameter that will be appended to the query string and filtered on in the security trimming stage. For example, the complete query URL might appear as:

    ```bash wrap theme={"dark"}
    http://localhost:8764/api/apollo/query-pipelines/test-default/collections/test/select?&wt=json&q=*:*&debug=false&fl=x,y,z&start=0&username=joe@bloggs.com'
    ```
  </Accordion>

  <Accordion title="Fusion Query Terms and Suggestions">
    Appkit supports the ability to generate suggestions as-you-type for successive query terms with Fusion via our [Solr suggestion services](/docs/4/app-studio/reference/search-platforms/solr/query-suggestions).

    ## Accessing the Suggest Component

    To access the Solr suggester in a Fusion application, refer to the section [Suggester](/docs/4/app-studio/reference/search-platforms/solr/query-suggestions).

    For reference, here is an example of how the Appkit configuration might appear for this particular service:

    ```yaml theme={"dark"}
    name: twigkit.search.solr.suggestions.SolrSuggestionsParserService
    source: platforms.fusion
    suggester: titleMatchSuggester
    parenthesis: true
    title: Staff
    custom: count[5]
    doctype: howto
    ```

    Here, the `source` defines the location of the fusion platform configuration. This will be used to identify the Fusion host and collection.

    ## Accessing the Terms Component

    To access the Solr Terms component in a Fusion application, refer to the section [Terms Component](/docs/4/app-studio/reference/search-platforms/solr/query-suggestions).

    For reference, here is an example of how the Appkit configuration might appear for this particular service:

    ```yaml theme={"dark"}
    name: twigkit.search.solr.suggestions.SolrQueryTermsService
    source: platforms.fusion
    term-fields: Symbol, Project_name
    title: Suggested phrase
    doctype: howto
    ```

    Here, the `source` defines the location of the fusion platform configuration. This will be used to identify the Fusion host and subsequently a collection that will contain fields as listed in `term-fields`.

    ## Ensure the terms request handler can be used with the Fusion query pipeline

    The terms component and request handler are provided out-of-the-box in the `solrconfig.xml` with Fusion. However, to ensure the query pipeline you are using does allow the terms handler to be used with queries, check that the `Query Solr` stage of your query-pipeline does list `terms` as an allowed request handler.

    ## Dynamic updates to multiple term queries

    Because the terms component only allows suggestions one term at a time, in cases when multiple terms are being typed, suggestions will be given for the last term to be typed.
  </Accordion>
</AccordionGroup>
