Projects‎ > ‎

Enhance Search

Introduction

Enhance the search to handle search configuration of each service for controlling default search and service specific search behavior. Also support Consumer Tier requests that contain advanced search operations

  • List a "default algorithm" for search
  • List searchable attributes (to prevent unindexed search or searches which will not work)
  • List available operators for searching (for advanced search)

Search Types

The configuration will assume that a default search will be performed unless an advanced search is selected by the client.

Default Search Algorithm

The default search algorithm will be dependent on the features supported by the context being used. The algorithm will attempt to configure itself in the following manner.

Properties ( defined by the Context)

Name Description
search.default.order An ordered list of attributes that are used by the search logic
search.contains.minchar Minimum number of character (for a search value) to use CONTAINS
search.operators A comma separated list of Query Operators that are supported

Input values:

  • The search input values (space delimited) which are supplied by the client are used as the input to the algorithm.
  • The configuration values which will be used by the algorithm to determine default behavior are search.default.order, search.operators, and searchable="true". These configuration values are described below.

Logic Conditions

Capability Description
AND Service supports AND-ing logic
OR Service supports OR-ing logic
CONTAINS Service can use wild-carding (before and after) for a given attribute

Combination Table, defines the possible conditions when a search "has" any of these items. Values refers to the user input, does the input contain "one" or "more than one" value:

AND OR CONTAINS Description Logic Condition
+ + + For each value, perform CONTAINS operation, against all attributes, OR them together. If more than one Value, then perform AND operation against all of the "OR" results 1
+ +   For each value, perform EQ operation, against all attributes, OR them together. If more than one Value, then perform AND operation against all of the "OR" results 2
+
+ Use first value, perform CONTAINS operation, against first attribute 5
+     Use first value, perform EQ operation, against first attribute 6
  + + Use first value, perform CONTAINS operation, against all attributes, OR them together 3
  +   Use first value, perform EQ operation, against all attributes, OR them together 4
    + Use first value, perform CONTAINS operation, against first attribute 5
      Use first value, perform EQ operation, against first attribute 6

Based on these inputs, the algorithm will use this Logic Conditions (this assumes 2 input search values and 3 search.default.order attributes). The input search values are each used to build the query with the search.default.order attributes in the following manner:

  1. search.operators property has AND, OR and CONTAINS:
     
    ( 
      ( search.default.order[0] CONTAINS value[0] ) 
      OR  
      ( search.default.order[1] CONTAINS value[0] ) 
      OR 
      ( search.default.order[2] CONTAINS value[0] ) 
    ) 
    AND
    ( 
      ( search.default.order[0] CONTAINS value[1] ) 
      OR  
      ( search.default.order[1] CONTAINS value[1] ) 
      OR 
      ( search.default.order[2] CONTAINS value[1] ) 
    ) 
    
  2. search.operators property has AND and OR:
     
    ( 
      ( search.default.order[0] EQ value[0] ) 
      OR  
      ( search.default.order[1] EQ value[0] ) 
      OR 
      ( search.default.order[2] EQ value[0] ) 
    )
    AND 
    (
      ( search.default.order[0] EQ value[1] ) 
      OR  
      ( search.default.order[1] EQ value[1] ) 
      OR 
      ( search.default.order[2] EQ value[1] )
    ) 
    
  3. search.operators property has OR and CONTAINS:
    ( search.default.order[0] CONTAINS value[0] ) 
    OR  
    ( search.default.order[1] CONTAINS value[0] ) 
    OR 
    ( search.default.order[2] CONTAINS value[0] ) 
    
  4. search.operators property has OR:
    ( search.default.order[0] EQ value[0] ) 
    OR  
    ( search.default.order[1] EQ value[0] ) 
    OR 
    ( search.default.order[2] EQ value[0] ) 
    
  5. search.operators property has AND and CONTAINS:
     
    search.default.order[0] CONTAINS value[0]
    
  6. search.operators property has AND:
     
    search.default.order[0] EQ value[0]
    

Configuration of Search Enhancements

Two new search properties are used in the configuration of the available search operators for a context and the default search order (used by the default search algorithm.

  • search.default.order
  • search.operators
<Operation id="search" attrgroup="person-search" connection="OpenDS" association="JNDI">
	<Properties>
		<Property name="operation.classname" value="org.openptk.provision.spi.operations.JndiOperations" />
		<Property name="key"                 value="uniqueid" />
		<Property name="rdn"                 value="uid=${uniqueid}" />
		<Property name="basedn"              value="%{jndi.basedn}" />
		<Property name="objectclass"         value="inetOrgPerson" />
		<Property name="timeout"             value="%{timeout.read}" />
		<Property name="sort"                value="lastname,firstname" />
		<Property name="search.default.order"       value="lastname,firstname" />
		<Property name="search.operators"           value="OR,AND,EQ,NE,BEGINS,ENDS,CONTAINS,LTE,LE,GE,GT,LIKE" />			                        
	</Properties>
	<Query type="EQ" name="objectClass" value="inetOrgPerson" />
</Operation>

Future

This section is used to document designs for future consideration


A new searchable property is available to and Attribute to designate the searchable attributes.

  • searchable="true"
<Associations>
	<Association id="SPML1">
		<Attributes>
			<Attribute id="uniqueid"  servicename="uid" searchable="true" />
			<Attribute id="firstname" servicename="gn" searchable="true" />
			<Attribute id="lastname"  servicename="sn" searchable="true" />
			<Attribute id="fullname"  servicename="cn" searchable="true" />
			<Attribute id="lastcommafirst" />
			<Attribute id="password"  servicename="password" required="true" />
			<Attribute id="email" />
			<Attribute id="roles" />
			<Attribute id="manager" />
			<Attribute id="title" />
			<Attribute id="telephone" />
			<Attribute id="organization" />
			<Attribute id="forgottenPasswordQuestions" />
			<Attribute id="forgottenPasswordAnswers" />
			<Attribute id="forgottenPasswordData" />
		</Attributes>
	</Association>
	.........
<Associations>