soen / Conjunction

A Sitecore utility designed to create configurable and personalizable queries for either the Lucene or Solr search engine using Sitecore's ContentSearch API
https://soen.github.io/Conjunction
MIT License
12 stars 1 forks source link

Rework the way that indexable entity types are configured and how properties from this is selected on search query rules #8

Open soen opened 7 years ago

soen commented 7 years ago

Currently, you have to define the indexable entity type by fully qualified namespace on the search query root item. In addition, for each search query rule, you have to specify the property name of the given indexable entity type that you want to perform the rule on. Although this works, this approach is prone to error, since both inputs are defined using a textbox without any kind of validation - the UI should handle this a bit more elegantly.

A solution to this could be to have a dropdown for selecting indexable types enumerate all assemblies in the Sitecore solution, and list all types that inherit from the IndexableEntity type. Then for search query rules, we could also use a dropdown, whereas the source of the property names must come from the configured indexable entity type set on the search query root item.

In terms of getting the correct elements displayed in the dropdown menus, one way would be to override the Sitecore.Pipelines.GetLookupSourceItems pipeline, and implement a specific pipeline for retrieving the types of indexable entity types as well as getting the fields of the selected indexable entity type using reflection. This blog post provides a good starting point for doing this: http://blog.rauljimenez.co.uk/getting-to-the-source/. The other alternative would be to create custom field types for each of the two, but that seems a bit over the top to do.