World-Three-Technologies / Masxaro-Prototype

Other
8 stars 4 forks source link

search function backend: post data format #27

Closed yichaoyu closed 13 years ago

yichaoyu commented 13 years ago

the format of data which the app should post caused problem. key/tag array cannot be simply included in the basicnamevaluepair. But I don't know if it is ok when I post the pairs like: new BasicNameValuePair("opcode", "key_search"); new BasicNameValuePair("key", "item1"); new BasicNameValuePair("key", "item2"); new BasicNameValuePair("key", "item3"); new BasicNameValuePair("key", "item4");

yaxing commented 13 years ago

keys should be posted as an array named 'keys', tags should be posted as an array named 'tags'

yaxing commented 13 years ago

for java String[] keys = {"coffee", "coke"}; String[] tags = {"restaurant", "gym"};

yaxing commented 13 years ago

then put them into a json object

yichaoyu commented 13 years ago

OK do I need to update the file in the ftp? ------Original Message------ From: yaxing To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 28, 2011 9:29 AM

then put them into a json object

Reply to this email directly or view it on GitHub: https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1672582

Sent via BlackBerry by AT&T

yichaoyu commented 13 years ago

Cuz u add the JSON decode? ------Original Message------ From: yaxing To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 28, 2011 9:29 AM

then put them into a json object

Reply to this email directly or view it on GitHub: https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1672582

Sent via BlackBerry by AT&T

yichaoyu commented 13 years ago

And return the basicinfo of the receipts which has just been hit by the search, and I'll list the store name of these receipts. Then, by clicking one of them, app will retrieve all the details of it from database. Or, like what we have discussed this morning, if the mobile app stores all the basicinfo of the receipts, the search func in back end could just return the receipt index (what we defined yesterday), then, the app could search and get the basicinfo of the hit receipts by using that index on app end. The rest work just like above talk. ------Original Message------ From: yaxing To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 28, 2011 9:29 AM

then put them into a json object

Reply to this email directly or view it on GitHub: https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1672582

Sent via BlackBerry by AT&T

yaxing commented 13 years ago

Ok, here's how my APIs working now. You can choose whether you're using JSON or not. If you're passing the parameters in JSON format, then you need to encapsulate all your parameters and post them as 'json'. Yichao, I believe you did this when you wrote the login page. For example,

JAVA:

        JSONObject jo = new JSONObject();
        HashMap<String, String[]> keysJson = new HashMap<String, String[]>();
        String[] keys = {"coffee", "coke"};  
        keysJson.put("keys", keys);
        jo.put("json", keysJson);
}```

PHP:
```$post = json_encode(array(
              'json'=>array('keys'=>array('food','coffee'))
));```

if you post without wrapping parameters into 'json', then parameters will be handled as non-JSON data
yichaoyu commented 13 years ago

Gotcha. I did this in receipts delivery request. ------Original Message------ From: yaxing To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 28, 2011 9:52 AM

Ok, here's how my APIs working now. You can choose whether you're using JSON or not. If you're passing the parameters in JSON format, then you need to encapsulate all your parameters and post them as 'json'. Yichao, I believe you did this when you wrote the login page. For example,

JAVA:

        JSONObject jo = new JSONObject();
        HashMap<String, String[]> keysJson = new HashMap<String, String[]>();
        String[] keys = {"coffee", "coke"};  
        keysJson.put("keys", keys);
        jo.put("json", keysJson);
}```

PHP:
```$post = array(
              'json'=>array('keys'=>array('food','coffee'))
);```

if you post without wrapping parameters into 'json', then parameters will be handled as non-JSON data

-- 
Reply to this email directly or view it on GitHub:
https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1672761

Sent via BlackBerry by AT&T
yaxing commented 13 years ago

searching APIs have been updated, now you can designate limit, orderby, groupby, orderdesc for result set(all are optional, meaning that you don't have to change anything now), also added getAllReceiptBasic, getReceiptItems and search receipts from certain sources APIs.

yaxing commented 13 years ago

team,

searching function has been upgraded (branch: backend):

tag, keyword, time searching have been integrated into one searching as 'AND' relationship (tag AND keyword AND time). keyword is for item name and store name. See php/receiptOperation.php::case 'search'.

Also, mobile searching has been integrated, if mobile searching, $post['mobile'] = true. then the result receipts will contain only basic information with tags (no items). See php/receiptOperation.php::$mobile

yichaoyu commented 13 years ago

I tried the following expression: String[] keys = {"Salad", “Coffee"}; param.put("keys", keys); But it doesn't seem to filter any of these key words.

yichaoyu commented 13 years ago

the search functionality has been implemented and the search API works well and I found no bugs up to now. Brian, please check the #137 on Redmine. There is the result list UI.

bshimkaveg commented 13 years ago

Will chk. Thx

bshimkaveg commented 13 years ago

I like it. Pls see comments on Redmine

yichaoyu commented 13 years ago

ok ------Original Message------ From: bshimkaveg To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 30, 2011 9:43 AM

I like it. Pls see comments on Redmine

Reply to this email directly or view it on GitHub: https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1688159

Sent via BlackBerry by AT&T

yichaoyu commented 13 years ago

I made some changes and gave you some feedbacks. Pls chk.

Yichao

2011/7/30 yichao@masxaro.com

ok ------Original Message------ From: bshimkaveg To: yichao@masxaro.com Subject: Re: [Masxaro-Prototype] search function backend: post data format (#27) Sent: Jul 30, 2011 9:43 AM

I like it. Pls see comments on Redmine

Reply to this email directly or view it on GitHub:

https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1688159

Sent via BlackBerry by AT&T

yichaoyu commented 13 years ago

I think I have finished the complete search functionality on the mobile. The screenshot of the UI has uploaded and I left a question about the app feature. Please check #137 on redmine. Thx I'm closing this issue.

bshimkaveg commented 13 years ago

I think the store / item search is good. The Tag Search is good too. I am not sure why you would select date search, since it is always a search parameter.

I was thinking that if you had a list of search date ranges , Last 7 days / Lat 14 Days / Last 30 days / Last 90 days / Custom

The Custom would refresh to the two date range entry.

Also, you put Total ($)

What happens if you had:

Merchant Date Total

McDonalds 7/1/11 $ 4.00 Airplane Ticket 7/2/11 ¥ 500.00 Hotel 7/3/11 € 250.00

yichaoyu commented 13 years ago

Ah, Now I know what you mean. Sorry. Right now, when users press the start, then there will be a Datepicker Dialog. See in the attached. So what do you want the custom date picker look like? What will happen when users select "Custom"?

My idea is put a "toggle" button right after the search range spinner.

  1. The button is with a Calendar Icon on it, when we use last N days to set search range;
  2. after users click the button, the icon on the button will change to List icon and the spinner will become two text frames, just like the two we have now. Users click on the either frame, a Datepicker Dialog will popup for users to pick a start date or a end date. Then, users will do the custom date search.
  3. By clicking the toggle button again, the two frames will change back to a search range spinner, last N days.

The currency is not a big problem. But just the back end doesn't support such feature for receipts.

The purple merchant, I think I fixed that problem before, and I've no idea why this happened again. Figure out later.

P.S: the tag search not implemented. So it's just an empty interface for future.

Yichao

On Mon, Aug 1, 2011 at 8:02 AM, bshimkaveg < reply@reply.github.com>wrote:

I think the store / item search is good. The Tag Search is good too. I am not sure why you would select date search, since it is always a search parameter.

I was thinking that if you had a list of search date ranges , Last 7 days / Lat 14 Days / Last 30 days / Last 90 days / Custom

The Custom would refresh to the two date range entry.

Also, you put Total ($)

What happens if you had:

Merchant Date Total

McDonalds 7/1/11 $ 4.00 Airplane Ticket 7/2/11 500.00 Hotel 7/3/11 250.00

  • This is why I suggested having a currency symbol on each line.

    Also, Merchant is in purple, I think it should be white like Date and Total.

Reply to this email directly or view it on GitHub:

https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1697118

yichaoyu commented 13 years ago

I implemented custom date UI. When users select Custom, there will be start/end date for users to set.

the currency feature on cellphone is ready, waiting for back end to test the UI.

On Mon, Aug 1, 2011 at 8:02 AM, bshimkaveg < reply@reply.github.com>wrote:

I think the store / item search is good. The Tag Search is good too. I am not sure why you would select date search, since it is always a search parameter.

I was thinking that if you had a list of search date ranges , Last 7 days / Lat 14 Days / Last 30 days / Last 90 days / Custom

The Custom would refresh to the two date range entry.

Also, you put Total ($)

What happens if you had:

Merchant Date Total

McDonalds 7/1/11 $ 4.00 Airplane Ticket 7/2/11 500.00 Hotel 7/3/11 250.00

  • This is why I suggested having a currency symbol on each line.

    Also, Merchant is in purple, I think it should be white like Date and Total.

Reply to this email directly or view it on GitHub:

https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/27#issuecomment-1697118

yichaoyu commented 13 years ago

currency feature works well