1

I can't find a way to get columns by second or any other part of the column name, for example if i have

user_id:timestamp

How can i select that column by timestamp and completely ignore user_id?

This is the code i'm using now:

$slice = new ColumnSlice( array('user_id'), "", 1);

$row = $cf->get("key", $slice);

Thank you.

Linas
  • 4,380
  • 17
  • 69
  • 117

1 Answers1

3

You can't. You have to specify the start and end values of the slice, and that means specifying at least the first of the composite values.

The converse of that is that you can do this, but you have to select all of the columns and test on the client side whether the filter criteria is met by each column value.

Chris Gerken
  • 16,221
  • 6
  • 44
  • 59
  • Okay then... Maybe there is some way to make first part to not be sorted while other two parts would be sorted? In other words can i disable sorting on some parts? – Linas Dec 18 '12 at 18:01
  • Do you ever need to filter based on the first component value, too? – Chris Gerken Dec 18 '12 at 18:29
  • Basically i need to make top comments system, so what i thought of is to use first part as votes and the second one as timestamp, so when i have 0 votes it will sort by timestamp, but as soon as i have at least 1 vote it will bubble up to the first place and so on. The problem is that i know timestamp, but there is no way to know how many votes there is since it can change at any time, that's why i wanted to ignore first part. – Linas Dec 18 '12 at 18:57
  • 1
    Sounds like you need to write the data both ways to satisfy your query model. – rs_atl Dec 18 '12 at 20:16