Maarten
Maarten

Reputation: 7308

Cloudant Search: Why are my wildcards not working?

I have a Cloudant database with a search index. In the search index I index the titles of my documents. For instance, search for 'rijkspersoneel':

http://wetten.cloudant.com/regelingen/_design/RegelingInfo/_search/regeling?q=title:rijkspersoneel

Returns 48 rows.

However, when I replace the 'o' with a ? wildcard:

http://wetten.cloudant.com/regelingen/_design/RegelingInfo/_search/regeling?q=title:rijkspers?neel

I get 0 results. Why is that? The Cloudant docs say that this should match 'rijkspersoneel' as well!

Upvotes: 0

Views: 849

Answers (1)

femtoRgon
femtoRgon

Reputation: 33341

My previous answer was definitely mistaken. Internal wildcads do appear to be supported. Try:

title:rijkspe*on*
title rijksper?on*

Fairly sure what is happening here is an analysis issue. Fairly sure you are using a stemming analyzer. I'm not really all the familiar with cloudant and their implementation of this, but in Lucene, wildcard queries are not subject to the same analysis as term queries. I'm guessing that your analysis of this field includes a stemmer, in which case "rijkspersoneel" is actually indexed as "rijkspersone".

So, when you search for

rijkspersonee*

or

rijkper?oneel

Since the "el" is missing from the end in the indexed form, you find no matches. When just searching for rijkpersoneel it does get analyzed though, and you search for the stemmed form of the word, and will find matches.

Stemming and wildcards just don't get along.

Upvotes: 1

Related Questions