grouper-dev - new jdbc source adapter with better searching
Subject: Grouper Developers Forum
List archive
- From: Chris Hyzer <>
- To: "" <>
- Subject: new jdbc source adapter with better searching
- Date: Fri, 22 May 2009 15:41:31 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
Hey,
At Penn we have 500k people in our person source, and it is hard to find
people in the UI with common names.
So I made a new jdbc source adapter that will split search strings by
whitespace and "AND" all terms together in the query.
Let me know if you are interested in this and if it seems like it would fit
your needs. Note: we already edited the subject API for Grouper 1.5, and
never branched, so this adapter is currently in grouper. When I merge to the
1.5 branch, I will put it in the subject.jar.
https://bugs.internet2.edu/jira/browse/GRP-280
Right now if I search for "john smith", and there is a user "john m. smith",
it will not find the user.
Make a jdbc source adapter that can find the user
This is done. To implement:
1. provide a table or view which has the subject information including the
search col (lowered). This will have better performance if you have a job
which dumps the data to one table periodically, and not just joining a bunch
of tables and calling to_lower()
2. configure in the sources.xml. Here is an example:
<source
adapterClass="edu.internet2.middleware.grouper.subj.GrouperJdbcSourceAdapter2">
<!--
CREATE TABLE `person_source_v` (
`penn_id` varchar(50) NOT NULL,
`name` varchar(50) default NULL,
`description` varchar(50) default NULL,
`pennname` varchar(50) default NULL,
`description_lower` varchar(50) default NULL,
PRIMARY KEY (`penn_id`)
);
insert into
`person_source_v`(`penn_id`,`name`,`description`,`pennname`,`description_lower`)
values ('10021368','Chris Hyzer','Chris Hyzer','mchyzer','chris hyzer,
mchyzer, 10021368'),('10039438','John Smith','John Smith','jsmith','john
smith, jsmith, 10039438');
commit;
-->
<id>pennperson</id>
<name>Penn person</name>
<type>person</type>
<init-param>
<param-name>jdbcConnectionProvider</param-name>
<param-value>edu.internet2.middleware.grouper.subj.GrouperJdbcConnectionProvider</param-value>
</init-param>
<init-param>
<param-name>dbTableOrView</param-name>
<param-value>person_source_v</param-value>
</init-param>
<init-param>
<param-name>subjectIdCol</param-name>
<param-value>penn_id</param-value>
</init-param>
<init-param>
<param-name>nameCol</param-name>
<param-value>name</param-value>
</init-param>
<init-param>
<param-name>descriptionCol</param-name>
<param-value>description</param-value>
</init-param>
<init-param>
<!-- search col where general searches take place, lower case -->
<param-name>lowerSearchCol</param-name>
<param-value>description_lower</param-value>
</init-param>
<init-param>
<!-- optional col if you want the search results sorted in the API
(note, UI might override) -->
<param-name>defaultSortCol</param-name>
<param-value>description</param-value>
</init-param>
<init-param>
<!-- col which identifies the row, perhaps not subjectId -->
<param-name>subjectIdentifierCol0</param-name>
<param-value>pennname</param-value>
</init-param>
<init-param>
<param-name>subjectIdentifierCol1</param-name>
<param-value>penn_id</param-value>
</init-param>
<!-- now you can count up from 0 to N of attributes for various cols -->
<init-param>
<param-name>subjectAttributeCol0</param-name>
<param-value>pennname</param-value>
</init-param>
<init-param>
<param-name>subjectAttributeName0</param-name>
<param-value>PENNNAME</param-value>
</init-param>
</source>
That is it, now you can search for "smith jo" and it will find john smith,
but will not return any smiths without "jo" in there somewhere. Note at Penn
we have the description field end in (active) for active employees, and
(NOT_ACTIVE). So if I search for "John Smith (active)" it will only return
active john smiths, including "john m. smith". We also have the data source
in there. So I could search for "(active) John Smith staf" and it would find
active john smiths who's primary affiliation with the university is
'employee'. We could put alternate names in the search col, or alternate
affiliations, etc. We load that table nightly with plsql so we can customize
as needed.
Notes:
- Case insensitive column names (can be very confusing in the default source
adapter)
- More efficient unmodifiable attribute maps and set values
- Supports multiple subjectIdentifier cols
Regards,
Chris
- new jdbc source adapter with better searching, Chris Hyzer, 05/22/2009
Archive powered by MHonArc 2.6.16.