Solr
  1. Solr
  2. SOLR-2580

Create Components to Support Using Business Rules in Solr

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: 4.5, 5.0
    • Component/s: Rules
    • Labels:
      None

      Description

      The goal is to be able to adjust the relevance of documents based on user defined business rules.

      For example, in a e-commerce site, when the user chooses the "shoes" category, we may be interested in boosting products from a certain brand. This can be expressed as a rule in the following way:

      rule "Boost Adidas products when searching shoes"
      when
      $qt : QueryTool()
      TermQuery(term.field=="category", term.text=="shoes")
      then
      $qt.boost("

      {!lucene}brand:adidas");
      end

      The QueryTool object should be used to alter the main query in a easy way. Even more human-like rules can be written:

      rule "Boost Adidas products when searching shoes"
      when
      Query has term "shoes" in field "product"
      then
      Add boost query "{!lucene}

      brand:adidas"
      end

      These rules are written in a text file in the config directory and can be modified at runtime. Rules will be managed using JBoss Drools: http://www.jboss.org/drools/drools-expert.html

      On a first stage, it will allow to add boost queries or change sorting fields based on the user query, but it could be extended to allow more options.

        Issue Links

          Activity

          Hide
          Simon Rosenthal added a comment -

          Tomas:l
          I'm not sure why you would want to encapsulate these kind of rules within Solr - an e-commerce site would always have an application layer between the UI and Solr which seems like the logical place to apply business rules leading to modifying the request by adding boosts, specifying sort order, etc.

          Also, is Drools separate from JBoss (which is used relatively in frequently in the Solr community) ?

          Show
          Simon Rosenthal added a comment - Tomas:l I'm not sure why you would want to encapsulate these kind of rules within Solr - an e-commerce site would always have an application layer between the UI and Solr which seems like the logical place to apply business rules leading to modifying the request by adding boosts, specifying sort order, etc. Also, is Drools separate from JBoss (which is used relatively in frequently in the Solr community) ?
          Hide
          Tomás Fernández Löbbe added a comment -

          Basically, it's just another component designed to modify the relevancy of documents, as the QueryElevationComponent is. Of course, this could be implemented by each site on the application layer but I think it would be very helpful to write one reusable component, then everybody can use the same, they don't reinvent the wheel and they can invest the effort in improving it.
          Should it be included in Solr? Personally I think this is something that can be useful to many people and it will add value to Solr. At the end, the community and the committers will decide if they think this is something worthily or not.

          JBoss AS is the application server, but JBoss is also an organization that runs many projects (like drools). You don't need to use any application server in particular to make Drools work. It's a library, not an application itself.

          Show
          Tomás Fernández Löbbe added a comment - Basically, it's just another component designed to modify the relevancy of documents, as the QueryElevationComponent is. Of course, this could be implemented by each site on the application layer but I think it would be very helpful to write one reusable component, then everybody can use the same, they don't reinvent the wheel and they can invest the effort in improving it. Should it be included in Solr? Personally I think this is something that can be useful to many people and it will add value to Solr. At the end, the community and the committers will decide if they think this is something worthily or not. JBoss AS is the application server, but JBoss is also an organization that runs many projects (like drools). You don't need to use any application server in particular to make Drools work. It's a library, not an application itself.
          Hide
          Grant Ingersoll added a comment -

          I'm going to start work on this, but would like to take it a bit beyond just Drools. As I see it, there are a number of requirements necessary to have a successful rules component:

          1. Boosting/reranking:
            1. search results
            2. facets
            3. Suggestions (spellchecking, related searches, etc. once these get added)
          2. Rules for adding/removing filters
          3. Modify fields (via the transformers in Solr) as they come out – for instance, alter the price field
          4. (Optional) Modify documents to be indexed by rules – lower priority

          I think Drools would make for a nice first implementation, but I also see that we the QueryElevationComponent (or a modified version of it) is a simple form of some of these things, so the idea would be to make a thin layer in between to make the engines pluggable.

          Show
          Grant Ingersoll added a comment - I'm going to start work on this, but would like to take it a bit beyond just Drools. As I see it, there are a number of requirements necessary to have a successful rules component: Boosting/reranking: search results facets Suggestions (spellchecking, related searches, etc. once these get added) Rules for adding/removing filters Modify fields (via the transformers in Solr) as they come out – for instance, alter the price field (Optional) Modify documents to be indexed by rules – lower priority I think Drools would make for a nice first implementation, but I also see that we the QueryElevationComponent (or a modified version of it) is a simple form of some of these things, so the idea would be to make a thin layer in between to make the engines pluggable.
          Hide
          Grant Ingersoll added a comment -

          I'm going to use this issue to be the "master" issue and then open/link other issues. There are some things that also need to be fixed in QEC to make it viable as an option for this stuff.

          Show
          Grant Ingersoll added a comment - I'm going to use this issue to be the "master" issue and then open/link other issues. There are some things that also need to be fixed in QEC to make it viable as an option for this stuff.
          Hide
          Grant Ingersoll added a comment -
          Show
          Grant Ingersoll added a comment - Wiki page is up: http://wiki.apache.org/solr/Business%20Rules
          Hide
          Hoss Man added a comment -

          bulk fixing the version info for 4.0-ALPHA and 4.0 all affected issues have "hoss20120711-bulk-40-change" in comment

          Show
          Hoss Man added a comment - bulk fixing the version info for 4.0-ALPHA and 4.0 all affected issues have "hoss20120711-bulk-40-change" in comment
          Hide
          Erik Hatcher added a comment -

          Grant - I'm guessing we're not getting this in for 4.0. Shall we kill the wiki page? (or at least make it abundantly clear that it's just pie-in-the-sky for now)

          Show
          Erik Hatcher added a comment - Grant - I'm guessing we're not getting this in for 4.0. Shall we kill the wiki page? (or at least make it abundantly clear that it's just pie-in-the-sky for now)
          Hide
          Robert Muir added a comment -

          rmuir20120906-bulk-40-change

          Show
          Robert Muir added a comment - rmuir20120906-bulk-40-change
          Hide
          Robert Muir added a comment -

          moving all 4.0 issues not touched in a month to 4.1

          Show
          Robert Muir added a comment - moving all 4.0 issues not touched in a month to 4.1
          Hide
          Steve Rowe added a comment -

          Bulk move 4.4 issues to 4.5 and 5.0

          Show
          Steve Rowe added a comment - Bulk move 4.4 issues to 4.5 and 5.0
          Hide
          Adrien Grand added a comment -

          4.5 release -> bulk close

          Show
          Adrien Grand added a comment - 4.5 release -> bulk close

            People

            • Assignee:
              Grant Ingersoll
              Reporter:
              Tomás Fernández Löbbe
            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development