1 <chapter id="search_framework">
2 <title>Search Framework</title>
3 Please read the short presentation of the <glossterm linkend="search">search framework</glossterm> for an introduction. You can also check the javadoc.
4 <section><title>The SearchTerm class</title>
5 The SearchTerm class attempts to encapsulate the relationships
8 <listitem>A fields or property of Content Entities </listitem>
9 <listitem>A field of Lucene Documents</listitem>
10 <listitem>An HTTP Query Parameter</listitem>
11 <listitem>And a bit of HTML on a Search Results Page </listitem>
14 The basic idea is that how you index, query, and display a
15 particular field in a resource are all intimately related, possibly
16 more so than how you index two different fields of the same
20 Instances of classes implementing SearchTerm are created when a Mir
21 content entity is indexed by the IndexingProducerNode Class. The
22 index method of each class is called in turn to add a bit of
23 information to the Lucene documents which will be added to the
24 index after it is created and all its fields specified. Instances
25 of the same classes are created by ServletModuleOpenIndy so that it
26 can construct a query to match against the lucene index, here the
27 makeTerm methods are called in turn to pick out the parameter they
28 want from the request and then construct the appropriate fragment
29 of lucene query, which are ultimately concatenated together. These
30 classes are also used to return appropriate template models
31 representing any hits to be displayed as a result of processing the
35 <section><title>Available search classes</title>
38 <term><classname>ContentSearchTerm</classname></term><listitem>tokenizes a string field in an Entity and indexes
39 it, but does not store it for retrieval (used for content_data)
40 </listitem></varlistentry>
43 <term><classname>ImagesSearchTerm</classname></term><listitem>indexes whether or not an Entity has associated
44 images, and also stores urls of those images for retrieval in the search results
45 </listitem></varlistentry>
47 <term><classname>KeywordSearchTerm</classname></term><listitem>indexes a field and stores it for retrieval, but
48 does not tokenize it. useful for things like strings representing
50 </listitem></varlistentry>
52 <term><classname>MediaSearchTerm</classname></term><listitem>not used
53 </listitem></varlistentry>
55 <term><classname>AudioSearchTerm</classname></term><listitem>indexes whether an Enity has audio
56 </listitem></varlistentry>
58 <term><classname>VideoSearchTerm</classname></term><listitem>indexes whether an Enity has video
59 </listitem></varlistentry>
61 <term><classname>TextSearchTerm</classname></term><listitem>tokenizes a string field in an Entity and indexes
62 it, and stores it for retrieval (used for description)
63 </listitem></varlistentry>
65 <term><classname>TopicSearchTerm</classname></term><listitem>used by indexing and querying documents based on Topic
66 </listitem></varlistentry>
68 <term><classname>UnIndexedSearchTerm</classname></term><listitem>Stores some metatdata for retrieval with a hit (for example a URL)
69 </listitem></varlistentry>
71 <term><classname>UnStoredSearchTerm</classname></term><listitem>not currently used
72 </listitem></varlistentry>
76 <section><title>Lucene field types</title>
78 The following brief guide to lucene field types is invaluable in
79 figuring out what a particular SearchTerm does:
82 Keyword is stored and indexed, but not tokenized
83 Text is tokenized,stored, indexed
84 Unindexed is not tokenized or indexed, only stored
85 Unstored is tokenized and indexed, but not stored