advanced search from setup advice needed

Oct 17, 2014 at 8:53 PM
I am working on a real estate almost build purely with 2sxc

Now i need to make an advances search from so i was thinking of doing a custom html form and pass the values in the querytring to the 2sxc listing page.

i have a property attached and each has a bunch of entities attached like city, zone, district, type etc.

what would be the best setup to only return the items where each of these items match whats is passed in the qurystring,

Any pointers?

Armand
Coordinator
Oct 18, 2014 at 2:22 PM
So if I understand you correctly, you are doing something like a full-text search on all fields?
Or are you trying to do a property-match of a sub-entity and need to return the top-entity?
Oct 18, 2014 at 3:10 PM
Well its more an advanced search based on a nr of value
So i am looking for a property with type appartment , city new york, and district central

All of these are entity types

But lets say i want to search also on 2 or more bathrooms and 2 or more bedrooms

Is there a way to get this kind of search so in the end. I get all apprtments in new yorx in central with 2 or more bathrooms and 2 or more bedrooms
Coordinator
Oct 18, 2014 at 3:29 PM
This shouldn't be too difficult. There are two approaches
  1. The code-based one, where you basically say something like this pseudo-code...
var houses = AsDynamic(App.Data["Appartments"]);

var foundhouses = select h from houses where h.Rooms = 1 and h.City = "New York"
of course, you'll usually have optional parameters, so it's more like
var houses = AsDynamic(App.Data["Appartments"]);

if(filtercity)
{
houses = houses.Where(h => h.City = "New York");
}
if(filterroom)
{
houses = houses.Where(h => h.Rooms = 2);
}
...etc.
  1. You could probably also use pipelines - but i'm not sure how you would handle the optional filters, so I won't suggest that for now