Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am the developer of Picky – so I am a bit biased ;)</p> <p>Your question seems to be, if I understand correctly:</p> <blockquote> <p>Given that I have products that contain the word "lime" in its name, and given that some of those products are not categorized as fruit, and some of those products are not categorized as fruit, but as beverages, you'd like the user to be able to filter the query so to only search for fruit.</p> </blockquote> <p>I hope I understand correctly.</p> <p>Picky's main mode is categorized search. That is, if somebody enters "lime fruit" in a query, Picky will find something like (name:lime, type:fruit), and all other combinations, eg. (company:lime, type:beverage). Or the user could already predefine through a nice interface, that he searches for fruits: "type:fruit lime", this would tell Picky to only look for results in type "fruit", and with "lime" in any category.</p> <p>However, since you'd like to filter according to whether something is in a category or not, I think a faceted search is best suited for this kind of task. Picky recently got faceted search added. So you'd do something like:</p> <p><code>picky_search.search "lime"</code></p> <p>to display the results for lime, but also display all possible types for "lime" on the side using</p> <p><code>picky_search.facets :type, filter: "lime"</code></p> <p>You'd get a hash of possible types, like so: <code>{ :fruit =&gt; 3, :beverage =&gt; 150 }</code>. Then, if the user clicked on "fruit", you'd send Picky another query, this time with the prepended filter:</p> <p><code>picky_search.search "type:fruit lime"</code> or <code>picky_search.search "type:fruit name:lime"</code> if it's already clear that the person is searching in the name for "lime".</p> <p>This would only return the lime of type fruit.</p> <p>This is only a quick overview, I hope it helps!</p>
 

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