How to do a Boolean search

As a user of the community in the search bar of the communities page, how can I do a Boolean search?

If I want to search something like

"apple AND Oranges"

"apple OR Oranges"

How can I do the above

  • Community uses Solr to provide search functionality. Out of the box, we configure to use Solr's edismax parser to handler user queries. This parser does many things one of which is to parse the user's query and based on optional configuration build a final query that requires a minimal set of clauses to match ('mm') before returning a result. There was a change to this parser that conflicts with our default settings when conditional operators other than 'AND' are used. This change was a topic of discussion here. To get the behavior you want I believe you can do one of the following (with caveats explained):

    Option 1. Remove Community 'mm' configuration so the parser does not see any default 'mm' setting and let it fall back to a behavior of 'mm' = 0 if any conditionals other than AND are present.

    Caveats:
    - You can no longer use 'mm' setting to do "smarter" logic based on a number of clauses. For example, you can longer configure, "if 1-3 clauses are provided require at least 2 matches before returning a result". Or, "if 5 clauses are provided require at least 3 clause matches."
    - You need to decide if you want all (AND) terms to match in a document or any (OR). It has to be one of these - no in between (unless you do custom code/logic). Once you make this decision, if its all (AND) add it to the edismax settings in your Solr configuration file (ex. \data\home\configsets\telligent-content-de63a3d\conf\solrconfig.xml). If you want OR, you do not have to configure this value as its the default.

    Example configuration of this setup:

    Note the commenting out of the 'mm' setting and adding the q.op setting

      <requestHandler name="/select" class="solr.SearchHandler">
        <!-- default values for query parameters can be specified, these
             will be overridden by parameters in the request
          -->
         <lst name="defaults">
           <str name="df">text</str>
           <str name="echoParams">explicit</str>
           <str name="defType">edismax</str>
           <str name="lowercaseOperators">false</str>  <!-- Set to true if you  "and" and "or" should be treated the same as operators "AND" and "OR". -->
           <str name="q.alt">*:*</str>
           <str name="rows">10</str>
           <str name="fl">*,score</str>
          <!-- <str name="mm">2<2 3<75% 9<66%</str> -->   <!-- 1-2 -> all terms required; 3 -> 2 terms required; 4-9 -> 75% required; 10+ ->66% required-->
          <str name="q.op">AND</str> <!-- remove if want OR -->
    
           <str name="qf">
              title^1.2 content^1.0 attachmenttext^1.0 tagtext^1.0
           </str>
    
           <!-- Highlighting defaults -->
           <str name="hl.fl">title content</str>
         </lst>
    
        </requestHandler>


    Option 2. Keep the mm setting but detect conditional operators within Community (custom code required)
    If you are keen on keeping the configurable 'mm' capabilities (i.e. setting other than all (AND) required or any (OR)), there is an option to write a custom plugin within Community to detect the logic of having a conditional present in the query and force a 'mm' value of 0. This is effectively what Solr does today but the fact that Community provides a default value within solrconfig.xml, means that there is always a 'mm' setting provided that is not 0. If you are interested in this route let me know and I can elaborate.

    Caveats:
        - Requires custom code
        - Need accurate conditional clause detection

    I have logged a bug to move some of this logic and configuration to the community side to allow effective use of the 'mm' configuration option.

    105729

  • The options suggested require changes to the existing setup.

    I wanted to know if we already have an existing setup, how can we achieve that without disturbing the current setup.

  • No, there is not a way to do this without making some type of change.

  • Verint | Telligent Community
    0 Verint | Telligent Community

    '#105729 Changes to Solr's behavoir with dismax parser and minimum match settings no longer allow using OR (and other conditionals) effectivlty' has been completed for 10.2.