How to do boolean queries like Java AND Oracle AND (Weblogic OR WebSphere

I want do boolean queries like

  • Java AND Oracle AND (Weblogic OR WebSphere
  • Java AND (Oracle OR “SQL Server”)

OptionalWords is an option . But Its not fully useful.

Thanks

Hi,

There 2 possibilities.

Logic inside the query:

The logic that you can do inside the query is limited to:

  • “Java Oracle Weblogic” => Java AND Oracle AND Weblogic => default behavior
  • “Java “Oracle Weblogic”” => Java AND “Oracle Weblogic” => Need advancedSyntax enabled
  • “Java Oracle Weblogic” => Java OR Oracle OR Weblogic => With optionalWords=querystring

Logic with facets

If those keywords are stored in an array in the record.

Like this:

{
  "title": "my title",
  "keywords": [
    "Java",
    "Oracle",
    "Weblogic"
  ]
}

You can define keywords in attributesForFaceting.

This will allow you to do filters like: (keywords:Java OR keywords:Oracle) AND keywords:Weblogic
There is still some restrictions that are explained in the doc.



You can also mix several filters (facets, query) depending on your needs but it might be a bit more complex to put in place.

1 Like