The document discusses custom search forms in Mimsy XG. It explains that a custom search form allows building a search screen with favorite searches to share with a work group. Fields from various sources can be added to the search form. Oracle text indexing can be used to improve search performance. The administration module is used to build the custom search form by adding fields and configuring search options. Multiple field indexes require creating a preference, attribute, index, and sync job.
2. Disclaimer Alert:
The Custom Search Admin Module is in BETA. It remains undocumented.
Though we will assist in making sure all of these components found below
are in working order, building of Oracle Text Indexes, building custom views
to expand searches, or building the Search form from scratch fall outside of
standard support.
4. The Custom Search Form is an open search screen for your collection.
You can build your own search screen full of your favorite searches and share it with
others in your working group by assigning it to one or more Views in your Mimsy XG
database.
Any field can be inserted in a search form, including those from related Authorities and
Activities, and Flexi fields.
Special functionality can be embedded in your search fields, like automatic wildcards,
case insensitive searching, and record retrieval using Oracle Text indexing.
The Custom Search Administration Module is the tool used to build the Custom Search
screen.
Custom Search Form
What is it?
6. Each field has a tag and a position.
Fields can be either
design elements (placeholders, headers) or
search criteria linked to one or more database field.
Each linked field requires a TABLE and FIELD to indicate what this search field will
search on in your database.
FIELD TYPE options include Text, Range (From-To), Checkbox, Radio Buttons and
Subject Header (for text placeholders).
Search Options include simple Term searching, Append wildcards (Term%), Append and
Prepend wildcards (%Term%) and Oracle Text Retrieval.
Custom Search Form Administration
7. Text Standard search type.
Range (from-to) Search type that takes Start and End criteria,
resulting in all records returned where value is within
the range. Ideal for Date and Number ranges.
Checkbox One or the other search type, where only two
possible values exist. A Checked box gives you
value 1, unchecked value 2.
Radio Buttons Search type where each Radio Button represents a
value. Ideal for small, controlled sets of values.
Section Header Text header to visually separate search fields.
Custom Search Form Field Types
8. No Wildcards Exact Term search.
Append Wildcards Automatically appends a % to your search (TERM%).
Append and Prepend Automatically appends and prepends a % to your
search (%TERM%).
Oracle Text Retrieval Uses Oracle Text engine to process the search.
Custom Search Form Search Options
9. 1. Choose a View and Module. Each View can have a separate Custom Search form.
2. Identify where the Search field should be placed. Each field has a numerical position
(including those fields marked as section headers). Each position number is a line
(position 1 is on line 1, position 2 is on line 2,…), and positions can have decimal
places to denote multiple fields on the same line, and the search field’s position
along a given line (position 8.2 is on the 8th line and is in the 2nd position). Use the
Preview button to see the Form layout.
3. Hit the New Field button. You’ll be prompted to enter a tag. The field will
automatically be positioned to the next full position number.
4. Edit the Position and Field Type as needed, and select the Table and Field from the
drop down menus, where Table is any table in the database. Note that the table
needs to have some search support with the Module of your Search form.
5. Fill in Default Value, List Name, Also Search and Hint Text properties if your Search
form requires it. Use F9 in your search field to pull up the list.
6. Include Search Options to append wildcards or if your Search field is associated with
an Oracle Text Index.
How to Create a Search Field
10. Oracle Text Indexes
Oracle Text Indexes help to make searches faster and allow greater range
and functionality to searches by parsing field values into individual
words, then managing references to records which contain those words
being searched.
Instead of taking time to scan through every record in a table, the search
finds the desired term in an index, then automagically retrieves the
corresponding records.
Indexes may be configured for single field searches or multiple field
searches. This allows you to build searches ranging from being very
specific to one field to a more broad, catch-all search.
Stopwords are stripped from searches by the Oracle database to push
efficiency. Stopwords, such as articles like THE, A/AN or conjunctions like
AND or ALTHOUGH, are typically not relevant to searches.
11. Creating Multiple-Field Indexes
There are 4 distinct parts to a Multi-Field Oracle Text Index. They are:
1. Preference
2. Attribute
3. Index
4. Sync Job
12. Creating Multiple-Field Indexes
Preference and Attribute
The Preference creation is really just defining a name and type for your
Oracle Text Index data, and the Attribute sets the columns to be indexed
within the Preference. Both the Preference and Attribute are created within
the same PL/SQL block:
BEGIN
ctx_ddl.create_preference('cs_keyword', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('cs_keyword', 'columns', 'description, title, item_name,
maker, place_made, culture, materials, note, option1, credit_line, option3,
option8, option10');
END;
/
Here we create a Preference called CS_KEYWORD as Multi-Column, and set
it to accept a number of columns, as required.
13. Creating Multiple-Field Indexes
Index
The Index is the actual Index database object, and it references the
Preference:
create index CTX_CATALOGUE_KEYWORD on
anactoria.tbl_catalogue(publish)
indextype is ctxsys.context parameters ('DATASTORE cs_keyword sync (every
"SYSDATE+1")');
The above statement creates an Index called CTX_CATALOGUE_KEYWORD.
The statement requires that the index refer to a specific table and field (in
this case, CATALOGUE.PUBLISH), though you see that, within the indextype
parameters, we reference our Preference, which includes all the fields in
our previously constructed Attribute.
The Index statement includes a sync job of EVERY SYSDATE+1, which means
every day, so every day, from the time the Index is created, the index is
synced up.
14. Creating Multiple-Field Indexes
Sync Job
Once the index is created, the Text is indexed in a background job
immediately.
Over time as you work in your database, you insert and update fields quite
regularly. Until a Sync job is performed on the index, the index will still only
store the data from when the index was created. The index needs to be
updated regularly to stay in sync with your database activity.
To manually sync an index, run the following:
exec ctx_ddl.sync_index('ANACTORIA.CTX_CATALOGUE_KEYWORD');
The statement above will sync the index on demand. As we saw in the
Create Index statement, a sync job is set up automatically to run daily, but
this creates a timespan where your Custom searches will not be entirely
accurate as the results reflect potentially day-old data.
15. Creating Multiple-Field Indexes
Sync Job Trigger Solution
What if we don’t want to have to remember to sync the index and we don’t
want to wait a day for accurate results?
We can create a trigger that updates the field that the index is created on, which
automatically syncs the index:
create or replace trigger anactoria.keyword_sync
before update of description, title, item_name, maker, …, on tbl_catalogue
for each row when (old.publish = new.publish)
begin
:new.publish := :new.publish;
end;
This trigger called KEYWORD_SYNC will update the PUBLISH field to itself
whenever an update is made to any of those fields references in our
Preference/Attribute, only when PUBLISH hasn’t actually been updated.
Gets the job done, but be wary of database slowdown while indexing…
16. Search Examples on Multi-Field Indexes
Using an Oracle Text Index with an Attribute field list of description, title,
item_name, maker, place_made, culture, materials, note, option1, credit_line,
option3, option8, option10, you can run the following
Skill and Craft AND
Skill and Craft or Technique AND/OR
(Skill or Craft) not Technique OR/NOT
“guitars=violins are stringed instruments” Equivalence
“green paint” Phrase
“green paint” within description WITHIN sections
“green paint” within option8 WITHIN sections
Near((boy, girl), 2) Near Search