This package is meant as an example for a store specific implementation of SEARCH. It consist mainly of three classes, BasicQuerySample, BasicExpressionFactorySample and BasicExpressionSample.

### How to integrate the sample to your store

The easiest way is to add a parameter to your store in domain.xml. Check for

`/slide/namespace/definition/store [@name="yourStore"]`

and add following parameter element:

<parameter name="basicQueryClass">org.apache.slide.search.basic.sample.BasicQuerySample</parameter>

Now for queries in that scope the BasicQuerySample class is called. For real implementations you could hard code that parameter within the store implementation. Add something like the following code into the initialize() method of your parent store.

            String queryClass = (String)parameters.get
                (BasicSearchLanguage.BASIC_QUERY_CLASS);

            if (queryClass == null) {
                parameters.put (BasicSearchLanguage.BASIC_QUERY_CLASS,
                                "org.apache.slide.search.basic.sample.BasicQuerySample");
            }

### How it works

Consider a query with following WHERE:

        <where>
          <or>
            <eq>
              <prop><displayname/></prop>
              <literal>cathgirls.mp3</literal>
            </eq>
            <lt>
              <prop><getcontentlength/></prop>
              <literal>100000</literal>
            </lt>
          </or>
        </where>

The expression factory will first be called for each leave expression (eq and lt). The factory may return a BasicExpression. Each of these expressions must be executable for themselves. Later the factory will be called for the or expression with both the eq and lt expression. The factory now may create an expression, that executes this at once. An SQL implementation for example would create a string like:

`WHERE prop.displayname = "cathgirls.mp3" or prop.getcontentlength < 10000`

For expressions that are not implemented by the store specific SEARCH, the factory must return null. If you look to ExpressionFactorySample, you will see, that gt is not implemented. If you pose the example query with gt instead of lt, the sample factory will return null for gt. This expression is now delegated to the generic factory. The call to the example factory for the or expresssion will return null as well, as a merge of a generic and an example expression is not possible. So in this case only the eq expression is executed by the example implementation.

The BasicExpression class is really store specific. It must know how to query the store and how to create slide objects (NodeRevisionDescriptor...) from the result set.