[help] boss_db matching

64 views
Skip to first unread message

till haxor

unread,
Jan 31, 2014, 8:24:56 PM1/31/14
to chica...@googlegroups.com
hi CB group, i need some help to db query, i need know if db_boss support multiple columns matching, for example:

i have some this:
 api('GET', ["search",Search]) ->
   
Var = boss_db:find(model, [{comment, 'matches', Search}])

and I want to search in another column besides comment.

can anyone help me?

Graeme Defty

unread,
Jan 31, 2014, 8:34:00 PM1/31/14
to chica...@googlegroups.com
Hi Till,

Sure!

As it says here http://www.chicagoboss.org/api-db.html, multiple conditions are supported.

g


--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/2fde0c3d-8f0e-46c2-98d7-f07c958773f0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

till haxor

unread,
Jan 31, 2014, 8:53:11 PM1/31/14
to chica...@googlegroups.com
hey thanks, but, in this case as would do?

 api('GET', ["search",Search]) ->
   
Var = boss_db:find(model, [{comment, 'matches', Search}])

if i want match in other column named foo for example?
boss_db:find(model, [{[foo,comment], 'matches', Search}]) ???


Graeme Defty

unread,
Feb 1, 2014, 12:02:43 AM2/1/14
to chica...@googlegroups.com

Just string the conditions together in a list.

Real example from my own app:

  CompEntries = boss_db:find(comp_entry,[{comp_id,equals,Id},{entrant_id,equals,EntryPlayer:id()}]),

Good luck!




--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.

till haxor

unread,
Feb 1, 2014, 9:00:19 AM2/1/14
to chica...@googlegroups.com
thanks for your answer,

this is a error that CB show me for the multiple conditions in boss_db

{{{badarg,[{re,run,[3,"till",[]],[]},
           
{boss_db_mock_controller,match_cond,2,
                                   
[{file,"src/boss_db_mock_controller.erl"},
                                     
{line,146}]},
           
{dict,filter_bucket,4,[{file,"dict.erl"},{line,481}]},
           
{dict,filter_bkt_list,4,[{file,"dict.erl"},{line,475}]},
           
{dict,filter_seg_list,4,[{file,"dict.erl"},{line,469}]},
           
{dict,filter_dict,2,[{file,"dict.erl"},{line,464}]},
           
{boss_db_mock_controller,do_find,7,
                                   
[{file,"src/boss_db_mock_controller.erl"},
                                     
{line,112}]},
           
{boss_db_mock_controller,handle_call,3,
                                   
[{file,"src/boss_db_mock_controller.erl"},
                                     
{line,24}]}]},
 
{gen_server,call,
             
[{global,boss_db_mock},
               
{find,review,
                     
[{comment,matches,"till"},{score,matches,"till"}],
                     all
,0,id,ascending}]}},
 
{gen_server,call,
             
[<0.104.0>,
             
{find,review,
                   
[{comment,matches,"till"},{score,matches,"till"}],
                    all
,0,id,ascending,[]},
             
30000]}}

can you help me?

i'm really interesting to work on ChicagoBoss, is great!!
excuse my bad English.

Graeme Defty

unread,
Feb 1, 2014, 9:02:28 AM2/1/14
to chica...@googlegroups.com
What does your source look like?



--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.

till haxor

unread,
Feb 1, 2014, 9:02:43 AM2/1/14
to chica...@googlegroups.com
sorry, this is my query

Review = boss_db:find(review,[{comment, 'matches', Search},{score, 'matches', Search}]),

I forget this.

till haxor

unread,
Feb 2, 2014, 1:05:24 PM2/2/14
to chica...@googlegroups.com
sorry, my code look:

Review = boss_db:find(review,[{comment, 'matches', Search},{score,
'matches', Search}]),

2014-02-01, till haxor <till....@gmail.com>:
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ChicagoBoss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/chicagoboss/j7VAgfKsX1k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> chicagoboss...@googlegroups.com.
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/e95809b6-7a35-4788-a8cf-0aed0437b626%40googlegroups.com.

Graeme Defty

unread,
Feb 2, 2014, 6:52:44 PM2/2/14
to chica...@googlegroups.com
That looks OK to me.

Perhaps it is the way you are using 'matches'. I have never used that option. Check your reg ex works as you expect too.


You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages