couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Newbie question: substring matching
Date Thu, 22 Jan 2009 16:56:08 GMT
Suppose I have a view which indexes a single field. Using startkey and
endkey, it's easy to find matches which start with a particular pattern.

But I'm wondering how best to do substring matches (in SQL: LIKE '%foo%')

I could:

1. Read the entire view, and filter it client-side (problem: large
   data transfer)

2. Create another view which enumerates all possible suffixes (problem:
   large index, O(N^2))

somedata
omedata
medata
edata
data
ata
ta
a

3. Create a temporary view for the exact search being done (problem: forces
   a read through all documents in the database)

Is there some other option I have overlooked, such as filtering the view
server-side somehow?

Thanks,

Brian.

Mime
View raw message