Note that there are some explanatory texts on larger screens.

plurals
  1. POFaceted search in linq
    primarykey
    data
    text
    <p>In my project I'm trying to implement Faceted search using Linq. I don't want to use Solr, Lucene, etc...</p> <p>My DB:</p> <p><strong>products</strong></p> <pre><code>+----+------+ | id | name | +----+------+ | 1 | prod1| +----+------+ | 2 | prod2| +----+------+ </code></pre> <p><strong>attributes</strong></p> <pre><code>+----+--------+---------+ | id | name | alias | +----+--------+---------+ | 1 | Weight | weight | +----+--------+---------+ | 2 | Height | height | +----+--------+---------+ </code></pre> <p><strong>values</strong></p> <pre><code>+----+---------------+---------+---------+ | id | attribute_id | value | alias | +----+---------------+---------+---------+ | 1 | 1 | 10 g | 10m | +----+---------------+---------+---------+ | 2 | 1 | 20 g | 20m | +----+---------------+---------+---------+ | 3 | 2 | 10 m | 10m | +----+---------------+---------+---------+ | 4 | 2 | 20 m | 20m | +----+---------------+---------+---------+ </code></pre> <p><strong>products_values</strong></p> <pre><code>+---------------+---------+ | product_id | value_id| +---------------+---------+ | 1 | 1 | +---------------+---------+ | 1 | 2 | +---------------+---------+ | 1 | 3 | +---------------+---------+ | 2 | 1 | +---------------+---------+ </code></pre> <p>Query for select, e.g. :<code>site.com/filter/weight=10g_20g;height=10h/</code></p> <p>POCO model for filter:</p> <pre><code>public class Filter { public string Attribute { get; set; } public IEnumerable&lt;Value&gt; Values{ get; set; } } </code></pre> <p>This model using for the custom model binding.</p> <p>But from now, having filled filter model, I don't know how implement select products and select "active" values in filter (with count enabled products). Populating filter and products table must be separated? Or, may be in single action? I'm glad to see step by step guide to implement faceted search using Linq.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload