Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Smart search result -> multiple SEARCH CONDITIONS View modes: 
User avatar
Member
Member
eagleag - 7/5/2010 7:23:50 AM
   
Smart search result -> multiple SEARCH CONDITIONS
Hi,
I would like to have multiple conditions in Search condition.
I tried:

+fieldNameA:2;fieldNameB:2;

and
+fieldNameA:2;&fieldNameB:2;

also tried putting them on separate lines as macros.

How can I check more than one field using Search condition?

Thanks?

User avatar
Member
Member
eagleag - 7/6/2010 4:25:23 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
I solved it this way:


In Smart search results (webpart) I changed Search options to FULL.

in search code:
string var = "apt && (numb1s:2 || numb2:2 ||  numb3:2 || numb4:2)";
UrlHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(var));


Is this the best way?
Is this dangerous? can someone mess up my DB throw url?

THANKS :)



User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 7/8/2010 3:23:35 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
Hello,

To be honest, I'm a bit confused what are you trying to achieve. Could you please describe us in more details what your goal is (I know about the need of adding multiple search conditions, but what about the complete goal - what should be the result like?). Maybe there is another way of doing that by another search condition syntax, but I'm also uncertain about the fields you want to search in and are involved in your solution.

Thank you in advance for information.

Best regards
Ondrej Vasil

User avatar
Member
Member
eagleag - 7/11/2010 7:04:36 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
STRUCTURE OF DATA IN DOCUMENT TYPE:
ap1name
ap1minPrice
ap1maxPrice
ap2name
ap2minPrice
ap2maxPrice
ap3name
ap3minPrice
ap3maxPrice

I would like to display in the result only the documents with one of these fields matching the selected value n. In SQL I would right
(ap1name=n or ap2name=n or ap3name=n or ap4name=n). How do I achieve this in Smart Search syntax?

AND have have dropdown for max price. how can I get this WHERE working:

WHERE ap3minPrice =< (Price selected by user) <=ap3maxPrice

THANKS

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 7/12/2010 3:25:45 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
Hello,

regardless the fact I'm a bit uncertain on the purpose of such condition (I mean, I'm wondering what way you want to use it on your page), you could use search condition with brackets:

(+ap1name:n +ap1minPrice:[(int)price TO (int)999999999] +ap1maxPrice:[(int)0 TO (int)price]) (+ap2name:n +ap2minPrice:[(int)price TO (int)999999999] +ap2maxPrice:[(int)0 TO (int)price]) (+ap3name:n +ap3minPrice:[(int)price TO (int)999999999] +ap3maxPrice:[(int)0 TO (int)price]) 


Please note, I haven't tested it so you might need to play with it if necessary. Moreover, you will need to pass n and price parameters to make it work.

Best regards
Ondrej Vasil

User avatar
Member
Member
eagleag - 7/12/2010 6:03:39 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
Hi,
I tried using just this:
+apt1price1:[(int){%max%} TO (int)99999]

when debug: +apt1price1:[(int)800 TO (int)99999]


apt1price1 is 1000. field is type integer.

but didn't work.
I also tried adding (int)apt1price1.

any idea how to solve this?

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 7/15/2010 6:45:43 AM
   
RE:Smart search result -> multiple SEARCH CONDITIONS
Hello,

in case you are not retrieving any search value, could you please try to add following key to web.config file and set it to false?

CMSSearchOnlyWhenContentPresent


Best regards
Ondrej Vasil