Product DocsMenu

Enabling the Question Mark Wildcard Behavior in a .NET Search Interface

The question mark character (?) is ignored by default (interpreted as space character) in a Coveo .NET Front-End search interface when included in a query. You can however configure the question mark to behave as a wildcard character when used in a query (see Using Wildcards in Queries).

The main reason why the question mark wildcard behavior is disabled by default is to allow end-users to search for question phrases.

Example: An end-user performs a natural language search for a document title that is a question, and he includes the question mark at the end of the phrase:

what are wildcards?

By default, the question mark wildcard behavior is disabled, the ? character is ignored and the index returns documents containing the wildcards term.

When the question mark wildcard behavior is enabled, the ? character is interpreted as a wildcard and the index only returns documents containing terms that match wildcards plus one (any) character at the end like wildcards1 or wildcardss, thus excluding documents containing wildcards, and most probably excluding documents that would be useful to the end-user.

Coveo .NET Front-End 12.0.57+ (November 2012) When the benefits of the question mark used as a wildcard in queries overcome the inconvenient mentioned above in your context, you can enable the question mark wildcard behavior.

To enable the question mark wildcard behavior in a .NET search interface

  1. Using an administrator account, connect to your Coveo Front-End server.

  2. Locate the folder of the skin used by the search interface in which you want to enable the question mark wildcard behavior.

  3. Using a text editor:

    1. Open the CoveoSearch.ascx file.

    2. Add the following code to the end of the file:

      <script runat="server">
        protected override void OnInit(EventArgs p_Args)
          SetupSearchBuilder += MySetupSearchBuilder;
        void MySetupSearchBuilder(object p_Sender, SetupSearchBuilderEventArgs p_Args)
          p_Args.Builder.UseQuestionMarkAsWildcards = true;
    3. Save the file.

  4. Repeat the procedure for each search interface skin and each Front-End server for which you want to enable the question mark wildcard behavior.

People who viewed this topic also viewed