Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Filtering on nested objects/properties

$
0
0

Hi,

I have problem where I need to be able to filter on properties on subpages but return the parent page from FIND. I thought that I could use nested queries for this but i does not seem to work.

Page structure is as follows:

Education page 1 (info)

      -Event page 1 (Event)

      -Event page 2 (Event)

      -Event page 3 (Event)

Education page 2 (info)

      -Event page 1 (Event)

      -Event page 2 (Event)

etc

and the page types look like this (generalised):

public class Education
{ public Education(string name) {  Events = getChildren(this.contentID); } public string Name { get; set; } public string SokSemesters { get; set; } public string SokLocations { get; set; } public string SokTerms { get; set; } public List Event { get; set; } //Nested object
}
public class Event
{  public string Semester { get; set; }  public string Location { get; set; }  public string Term { get; set; }
}


I index both Education and Event pages and have access to them from FIND. I search over the Education type because I want to present educations in the search result (with events) and in filter options with count over how many educations each filter options result in (using facetts). The SokSemesters, SokLocations and SokTerms are a actually just collections(comma separated string) of corresponding properties on all the events that belong to a certain education. I use SokSemesters, SokLocations and SokTerms to generate the facetts.

Now to the tricky part. I want to be able filter on semester, location and term on the events and only returning matching educations. Between different types of filters AND should be used and within the same type of filter OR should be used (you can have multiple filters of the same type). I have tried something like this:

.Filter (X => x.Events, x => x.Location.MatchCaseInsensitive (Location);

But it does not seem to work, it does not filter educations correctly. So I am wondering if I am missing something about nested queries? Or is there any other way of doing this, for example by using a content area and putting the events there?

Thanks

Magnus


Viewing all articles
Browse latest Browse all 9076

Trending Articles