Wildcard searches in MarkLogic

Viewed 32

I have enabled three character searches in my MarkLogic database. After enabling the three character search, I can see the two character and one character searches are disabled by default.

Does it mean once the three character search is enabled in MarkLogic, we don't need to enable the two and one character search explicitly?

1 Answers

Generally, no, you don't need to enable one or two character indexes. They will create really large backing indexes. Unless you have a requirement to search with one or two characters, then it probably isn't worth the cost in terms of index size.

You may want to enable them for a particular set of elements in a field index, but a database-wide index setting is probably going to be overkill.

The Secrets to Wildcard Search in MarkLogic blog entry provides a good explanation of the wildcard indexes and how they are used in searches.

Whether or not you enable two character searches or one character searches depends upon what functionality you need, the performance you expect, and the resources you are willing to allocate.

Enabling Wildcard Searches

Wildcard searches use character indexes, lexicons, and trailing wildcard indexes to speed performance. To ensure that wildcard searches are fast, you should enable at least one wildcard index (three character searches, trailing wildcard searches, two character searches, and/or one character searches) and fast element character searches (if you want fast searches within specific elements) in the Admin Interface database configuration screen. Wildcard searches are disabled by default. If you enable character indexes, you should plan on allocating an additional amount of disk space approximately three times the size of the source content.

Recommended Wildcard Settings

To enable any kind of wildcard query functionality with a good combination of performance and database size, MarkLogic recommends you enable the following index settings:

This combination will provide accurate and fast wildcard queries for a wide variety of wildcard searches, including leading and trailing wildcarded searches. If you add the trailing wildcard searches index, you will get slightly more efficient trailing wildcard searches, but with increased database size.

Related