Partial Selection - StartKey and EndKey

As explained in
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...

I am planning to subset the results of a view by Partial selection using StartKey and EndKey

For instance to find all nodes which have almond*, I plan to do the following

var client = CouchbaseManager.Instance;
var view = client.GetView("nuts", "nutsonly");
string searchKey = "almond"
view.StartKey(searchKey);
view.EndKey(searchKey + "\u02ad");

Is this kind of queries using wildkey - encouraged or discouraged - especially from a performance point of view ?

If this is discouraged, then I need to some how find all the nodes with Almond* as its key. Which other approach do you recommend.

1 Answer

« Back to question.

Hello,

What you are doing is correct, and this is why the views have been designed for.

The only commend that I will do is usually with Couchbase we use in range query\uefff that is the last unicode character.

If you look at the beer sample application you will see that this is how we deal with such requirements. Here for example the Java code that look for all the "Breweries with a name starting by ":
https://github.com/couchbaselabs/beersample-java/blob/master/src/main/ja...

Regards
Tug
@tgrall