<commit_before>
<table style="width:100%;table-layout:fixed" ><tr>
	
<td id="sideBarTd" style="width:25%"> 

<div id="sidebar"> <!-- Sidebar -->

<div id="linkpool" > <!-- Links to main pages, id=linkpool-->
<table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc">Main pages</a></h3></div>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./install.html">Install</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./configuration.html">Configuration</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-search.html">RESTful API : Search</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-insert-update-delete.html">RESTful API : Insert/Update/Delete</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-control.html">RESTful API : Control</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./geo.html">GEO Search</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./ranking.html">Ranking</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./mongodb.html">MongoDB Search</a></br><br>
</td></tr></tbody></table>
<span ><a  href="http://www.srch2.com" target="_blankt"><img  style="width:100px" src="images/logo.png" /></a></span></br></br>
</div> <!-- Links to main pages, id=linkpool-->
<hr/>
<div id="content" > <!-- Table of content, id=content-->
<table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc">Content</a></h3></div>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#overview">1. Overview</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#configTag">2. Config</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#srch2Home">3. SRCH2HOME</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#licenseFile">4. License File</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#listeningHostname">5. Hostname & Port</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataDir">6. Data Directory</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#data">7. Data Source Information</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataSources">7.1. Data Source Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataFile">7.2. Data File</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#mongodb">7.3. MongoDB</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#indexConfig">8. Index Config</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#indexType">8.1. Index Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fieldBoost">8.2. Field Boosts</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#recordBoostField">8.3. Record Boost Field</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#defaultQueryTermBoost">8.4. Default Query Term Boost</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryConfig">9. Query Parameters</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#rankingalgorithm">9.1. Ranking</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermSimilarityBoost">9.2. Term Similarity Boost</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermSimilarityThreshold">9.3. Term Similarity Threshold</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#supportSwapInEditDistance">9.4. Support Swap in Edit Distance</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermLengthBoost">9.5. Query Term Length Boost</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#prefixMatchPenalty">9.6. Prefix Match Penalty</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#cacheSize">9.7. Cache Size</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#rows">9.8. Rows to be returned</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#maxSearchThreads">9.9. Max Searcher Threads</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fieldBasedSearch">9.10. Enabling Field Based Search</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#searcherType">9.11. Search Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermMatchType">9.12. Term Match Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermType">9.13. Query Term Type</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryResponseWriter">10. Response Writer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#ResponseContent">10.1. Response Content</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#updateHandler">11. Update Handler</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#maxDocs">11.1. Max Documents</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#mergePolicy">11.2. Merge Policy</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#updateLog">11.3. Logging</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#logLevel">11.4. Log Level</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#accessLogFile">11.5. Log File</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#schemaTag">12. schema</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#uniqueKey">12.1. Primary Key</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fields">12.2. Field Declaration</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#facetEnabled">12.3. Enable Facets</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#facetFields">12.4. Facet Field Declaration</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#analyzer">12.5. Analyzer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#PorterStemFilter">12.5.1 Stemmer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#StopFilter">12.5.2 Stop Words</a></br><br>
</td></tr></tbody></table>

</div> <!-- Table of content, id=content-->

</div> <!-- Sidebar -->

</td>

<td id="docBody" style="width:70%">
</br>
<div><table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc"></a></h3></div>

</td></tr></tbody></table></div>
#<center>SRCH2 Documentation: Engine Configuration</center>#{id="doc" style="color:#880000" }
######<center>Version: 4.0, Date: September 19, 2013</center>{id="versionInfo" style="font-size: 12px; margin-top: -20px;"}
###1. Overview:###{id="overview"}
>The SRCH2 engine can be customized using a configuration file in XML. This documentation describes the details of how to do this configuration.

>The configuration file contains two top-level tags: "config" and "schema". The children of the "config" (e.g., "srch2home") tune the engine, while the children of the "schema" tag (e.g., "fields") describe the data. Each parameter can have one of the following two labels: "Required" means this tag has to be present in the configuration file, and "Optional" means this tag does not need to be present.

###2. Config Component:{id="configTag"}
> The following is a breakdown of the subtags of the "config" component.

####3. SRCH2 Home Directory, Required{id="srch2Home"}
```
<srch2Home>/path/to/srch2/home/directory</srch2Home>
```
> This parameter specifies the installation folder of the SRCH2 engine, which includes the binary, license file, and other files needed by the engine. Other file paths used in the configuration should be relative to this home path. For example, if we give the engine a data file at "/usr/joe/srch2/data/sample-data.json", and the SRCH2 home directory is set to "/usr/joe/srch2", then the configuration file should reference the data file's location as "data/sample-data.json".

####4. License Key File, Required{id="licenseFile"}
```
<licenseFile>/path/to/srch2_license_key.txt</licenseFile>
```
>It specifies a license key file required by the engine. Email <EMAIL> to get a key file. You can also fill in a [form](http://srch2.com/try.php) to get a free trial key. <br>


####5. Hostname and Port, Required{id="listeningHostname"}
```
<listeningHostname>127.0.0.1</listeningHostname>
<listeningPort>8081</listeningPort>
```
> Hostname is the IP address, redirect specified in iptables, or masking name specified in the /etc/hostname which the client will use to reach this server.<br>
> Specify as 0.0.0.0 if value is unknown.

####6. Data Directory, Required{id="dataDir"}
```
<dataDir>/path/to/data/directory/</dataDir>
```
> It specifies the path of a folder where the engine stores serialized index files. <br>



####7. Data {id="data"}

>####7.1. Data Sources, Optional {id="dataSources"}

```
<dataSourceType>1</dataSourceType>
```
>> It specifies the type of data source to build the indexes from.

>>>        1 - json data file. (Default)
>>>        2 - Mongo Db.

>####7.2. Data File, Required if "dataSourceType" is 1 {id="dataFile"}

```
<dataFile>/path/to/data.json</dataFile>
```
>> It specifies a JSON data file to be loaded by the engine.<br>

>####7.3. MongoDB, Required if "dataSourceType" is 2 {id="mongodb"}
```
<mongodb>
    <host>www.my-company.com</host>
    <port>1234</port>
    <db>database-name</db>
    <collection>collection-name</collection>
    <listenerWaitTime>3</listenerWaitTime>
</mongodb> 
```
>> It specifies MongoDB instance information.
>> Note: listenerWaitTime must be specified in seconds. It specifies how frequently SRCH2 engine is updated from your MongoDB instance (e.g., every 3 seconds). 

####8. Index Config:{id="indexConfig"}
> This tag includes parameters related to customizing the indexes.
```
<indexConfig>
...
</indexConfig>
```
>####8.1. Index Type, Required{id="indexType"}
```
<indexType>0</indexType>
```
>> 0: Text Indexes; <br>
>> 1: Text + Geo Indexes, which support location-based search. <br>


>####8.2. Field Boosts, Optional{id="fieldBoost"}
```
<fieldBoost></fieldBoost>
```
>> It specifies boost values for the <a href="#fields">searchable attributes</a>. A boost value is in the range [1,100]. If the value is outside the range, it will be set to 1. For example, the boost values for three searchable attributes can be specified as: <br>
```
<fieldBoost>relevance^10 name^7 title</fieldBoost>
```
>> Notice that the fields are sparated by a single white space. If a value is not provide for a field, the engine uses a default value of 1.<br>


>####8.3. Record Boost Field, Optional{id="recordBoostField"}
```
<recordBoostField>relevance</recordBoostField>
```
>> It specifies an attribute whose value is used as the boost value of a record's score. The attribute needs to be of float type.
>####8.4. Default Query Term Boost, Optional{id="defaultQueryTermBoost"}
```
<defaultQueryTermBoost>1</defaultQueryTermBoost>
```
>> It specifies a default [query term boost](configuration.html##Boosting a term). If the parameter is not given, the engine uses 1 as the default value.<br>


####9. Query parameters:{id="queryConfig"}
> The following tag includes parameters related to queries.
```
<query>
...
</query>
```
>####9.1. Ranking:{id="rankingalgorithm"}

>> The following tags and parameters are related to ranking. See http://www.srch2.com/download.html for ranking-related information.

```
<rankingalgorithm>
<recordScoreExpression>idf_score*doc_boost</recordScoreExpression>
</rankingalgorithm>
```

>####9.2. Term Similarity Boost, Optional{id="queryTermSimilarityBoost"}

```
<queryTermSimilarityBoost>0.9</queryTermSimilarityBoost>
```
>> It specifies a similarity boost used in computing the score of a record in fuzzy search. See the [fuzzy matched keywords](querysyntax.html#Fuzzy Searches) section about how this parameter is used. Its default value is 0.5.

>####9.3. Term Similarity Threshold, Optional{id="queryTermSimilarityThreshold"}
```
<queryTermSimilarityThreshold>0.5</queryTermSimilarityThreshold>
```
>> It modifies the default behavior of [fuzzy match keyword search](querysyntax.html#Fuzzy Searches). Its value must lie in [0,1] with 1 representing exact match, and 0 being the largest possible search neighbourhood. Its default value is 0.5.

>####9.4. Support Swap in Edit-distance operations, Optional{id="supportSwapInEditDistance"}
```
<supportSwapInEditDistance>true</supportSwapInEditDistance>
```
>> It specifies we 'swap' should be considered an edit-distance operation or not. By default edit-distance calculator uses insertion, deletion, substitution and swap.

>####9.5. Query Term Length Boost, Optional{id="queryTermLengthBoost"}
```
<queryTermLengthBoost></queryTermLengthBoost>
```
>>Check [the ranking section](ranking.html) to see how this value is used in the ranking function. Its default value is 0.5. <br>


>####9.6. Prefix Match Penalty, Optional{id="prefixMatchPenalty"}

```
<prefixMatchPenalty>0.95</prefixMatchPenalty>
```
>> It specifies the penalty for a prefix match. This value reduces, by a multiple, the score of a record with a prefix matched term. <br>
>> The value should be in the range of 0 to 1. its default value is 0.95. See [the ranking section](ranking.html) <br>


>####9.7. Cache Size, Optional{id="cacheSize"}

```
<cacheSize>65536000</cacheSize>
```
>> It specifies the number of bytes used in caching. The number should be in the range [50MB, 500MB] ([52428800,524288000]). Its default value is 52428800. <br>

>####9.8. Default value for number of returned results, Optional{id="rows"}
```
<rows>10</rows>
```
>> It specifies the number of results retrieved. Its defaults value is 10. <br>

>####9.9. Maximum number of search threads, Optional:{id="maxSearchThreads"}
```
<maxSearchThreads>2</maxSearchThreads>
```
>> It specifies the number of threads that serve search requests. Its default value is 1. <br>

>####9.10. Field Based Search Enabled, Optional{id="fieldBasedSearch"}
```
<fieldBasedSearch>0</fieldBasedSearch>
```
>>> It is a flag to toggle attribute-based search. An attribute-based search has conditions on which attributes a keyword needs to appear in.<br>
>>>> 0 - Disabled <br>
>>>> 1 - Enabled <br>
>>>> Note that if field-based search is enabled, the number of searchable attributes as specified in <a href='#fields'>fields</a> is limited to 31.


>####9.11. Search Type, Optional{id="searcherType"}
```
<searcherType>0</searcherType>
```
>> It sets the default search type of a query to the engine. <br>
>>> 0: finding the top relevant results; <br>
>>> 1: finding all matching results. <br>
>Its default value is 0.<br>

>####9.12. Query Term Match Type, Optional{id="queryTermMatchType"}
```
<queryTermMatchType>1</queryTermMatchType>
```
>> It modifies the default search behavior of the engine
>>> 0: exact match search;<br>
>>> 1: fuzzy match search.<br>
>>> Its default value is 0.

>####9.13. Query Term Type, Optional{id="queryTermType"}

```
<queryTermType>0</queryTermType>
```
>> It modifies the default treatment of search query's keyword:<br>
>>> 0: the term is treated as a prefix; <br>
>>> 1: the term is treated as a complete term; <br>
>> Its default value is 0.


>####10. Response Writer:{id="queryResponseWriter"}
>> This tag has parameters related to configuring the response of a query.
```
<queryResponseWriter>
...
</queryResponseWriter>
```

>>####10.1. Response Content, Optional{id="ResponseContent"}
```
<responseContent type="2">lat,lng</responseContent>
```
>>>or

```
<responseContent type="0"></responseContent>
```
>>> It specifies the format of each json search response. You should set the type to one of the following options: <br>
>>>> 0: format "rid,edit_dist,matching_prefix,in_memory_record"; <br>
>>>> 1: format "rid,edit_dist,matching_prefix". <br>
>>>> 2: format "rid,edit_dist,matching_prefix,fields_to_return". <br>
>>>> Its default value is 0. <br>
>>>> It is REQUIRED to include a comma separated list of fields in the tag if it is 2 <br>
>>>> <br>

####11. Update Handler:{id="updateHandler"}
> This tag includes tags related to configuring the engine to handle update requests.
```
<updatehandler>
...
</updatehandler>
```
>####11.1. Maximum Number of Documents, Required{id="maxDocs"}
```
<maxDocs>15000000</maxDocs>
```
>> It specifies the maximum number of records indexable by the engine. Inserting more records than the specified here will cause the insertions to fail.
>####11.2. Merge Policy, Required{id="mergePolicy"}

```
<mergePolicy>
<mergeEveryNSeconds>10</mergeEveryNSeconds>
<mergeEveryMWrites>100</mergeEveryMWrites>
</mergePolicy>
```
>> "mergeEveryNSeconds": The engine uses a background thread to periodically merge the data changes to the indexes. This parameter sets the number of seconds this background sleeps before it wakes up and does the merge. Note that decreasing this number will increase latency in the engine's response time.
>> mergeEveryMWrites: <br>
>> "mergeEveryMWrites": Another event that can trigger the background thread to do the merge is the number of data changes (inserts, deletes, and updates). This parameter specifies the number of record changes that can wake up the thread to do the merge. <br>

>####11.3. Logging:{id="updateLog"}
>> The following tag includes parameters related to logging in SRCH2.
```
<updateLog>
...
</updateLog>
```
>>####11.4. Log Level, Optional{id="logLevel"}
```
<logLevel>3</logLevel>
```
>>> The parameter decides the amount of feedback information the engine will report in its log. <br>
>>>> 0: SILENT <br>
>>>> 1: ERROR <br>
>>>> 2: WARNING <br>
>>>> 3: INFO <br>
>>> Its default value is 3.

>>####11.5. Log File, Required:{id="accessLogFile"}
```
<accessLogFile>./data/faceted_search/log.txt</accessLogFile>
```
>>> It specifies the file to which the engine writes logging information.<br>


###12. Schema Component:{id="schemaTag"}
> The following sections explain each subtag under the <i>schema</i> component.
```
<schema name="SRCH2" version="3">
...
</schema>
```

####12.1. Primary Key:{id="uniqueKey"}
> Primary Key: Required
```
<uniqueKey>id</uniqueKey>
```
> It specifies the attribute used as the primary key to reference each record in the data. If a inserted record has a primary key conflicting with an existing record, the new record will be rejected by the engine. The attribute needs to be of text type.<br>

####12.2. Fields, Required{id="fields"}
```
<fields>
...
</fields>
```
> This tag is a container of all field-related tags.

```
<field name="category" type="text" indexed="true" />
<field name="name" type="text" indexed="true" />
<field name="model" default="benz" required="true" type="text" indexed="false"/>
<field name="price" default="200" required="true" type="float" indexed="false"/>
<field name="likes" default="0" required="true" type="integer" indexed="false"/>
```
> These parameters give information about each field, including its name, type, and certain properties. <br>

> "name" : the name of the field<br>
> "type" : the type of the field. Supported types are:<br>
>> - Text<br>
>> - integer<br>
>> - float<br>
>> - time<br>
>> - location_longtitude (For Geo search)<br>
>> - location_latitude (For Geo search)<br>

>> The engine supports the following formats of time and date: <br>
>>> HH:MM:SS<br>
>>> MM/DD/YY<br>
>>> YY-MM-DD HH:MM::SS<br>
>>> YYMMDDHHMMSS<br>
>>> YYMMDDHHMM<br>
>>> YYMMDD<br>

>>> The engine supports the following formats of time duration: <br>
>>> {An integer}{A date/time constant}, in which date and time constants are: <br>
>>> SECOND,SECONDS,MINUTE,MINUTES,HOUR,HOURS,DAY,DAYS,WEEK,WEEKS,MONTH,MONTHS,YEAR,YEARS<br>
>>> Examples are: "DAY" (meaning 1 day) or "34WEEKS" (meaning 34 weeks).<br>

> Each field has certain properties:<br>
>> "required": The flag indicates whether this field can be empty or not. It is false by default.<br>
>> "default" : It gives the default value of this field if the value is missing.<br>
>> "searchable" : If it is true, then the engine will include its values in the indexes to support keyword search on this field.<br>
>> "refining" : If it is true, then the engine will include its values in the indexes to support postprocessing operations on query results, such as additional filtering predicates (e.g., "price < 20"), sort, and facet.<br>
>> "indexed": If this flag is true, then the engine will treat it as both a searchable and a refining attribute. <br>
> Note:<br>
>> - For geo search, two fields are required with the types location_latitude and location_longitude, respectively. The values of these geo fields should be float in the data file.<br>
>> - The primary key is optional to be included here. It can also be searchable and/or refining.<br>
>> - There must be at least one searchable field.

####12.3. Enable Facet:{id="facetEnabled"}
> Facet enabled flag <br>
> **Optional** <br>
> Toggles faceted search feature.<br>
```
<facetEnabled>true</facetEnabled>start
```
> - values are false (disabled) and true (enabled)<br>
> - By default it is disabled.<br>


####12.4. Facet Fields:{id="facetFields"}
> This tag contains all facet-related tags.
```
<facetFields>
...
</facetFields>
```
> Facet fields: Required if facet is enabled <br>
```
<facetField name="likes" facetType="range" facetStart="0" facetEnd="50" facetGap="10" />
<facetField name="model" facetType="categorical" />
<facetField name="price" facetType="range" facetStart="0" facetEnd="100" facetGap="10" />
```
>> - name: The name of the field used for this facet. It must correspond with a refining field specified in the <a href=#fields>field tag</a>. <br>
>> - facetType: Facet type, which is either categorical or range. <br>
>> - facetStart: The start point of making range facets. It is required for a range facet. The value will be ignored for categorical facets. <br>
>> - facetEnd: The end point of a range facet. It is required for a range facet. The value will be ignored for categorical facets. <br>
>> - facetGap: The increment amount used for making demarking a range facet. It is required for a range facet. The value will be ignored for categorical facets. <br>
>>> Note: fact ranges are created in correspondence with the "facetStart" value, not the "facetEnd" value. Therefore, the last interval may not stretch the entire facetGap. Also all facet fields must be declared in <a href=#fields>fields tag</a> as well (with refining="true") <br>

####12.5. Analyzer:{id="analyzer"}
> It specifies the analyzer used by the engine. <br>
```
<types>
<fieldType name="text_en">
<analyzer>
...
</analyzer>
</fieldType>
</types>
```
>>####12.5.1 Stemmer, Optional{id="PorterStemFilter"}
>>The engine supports [Porter Stemming](http://tartarus.org/martin/PorterStemmer/). It uses a dictionary file with keywords that should be ignored by the stemmer. If no file if provided, the stemmer is disabled.
```
<filter name="PorterStemFilter" dictionary="stemmer-dictionary.txt" />
```
>>####12.5.2 Stop Words, Optional{id="StopFilter"}
>> It specifies a file of stop words that can be ignored by the engine. Providing "" for "words" option can disable this filter.
```
<filter name="StopFilter" words="stop-words.txt" />
```
<hr/>
Have fun SRCHing!


<link rel="stylesheet" type="text/css" href="documentation.css">



<script type="text/javascript" src="setSizes.js"></script>
<script>

setSizes();
window.onresize = setSizes
</script><commit_msg>minor changes on configuration docs<commit_after>
<table style="width:100%;table-layout:fixed" ><tr>
	
<td id="sideBarTd" style="width:25%"> 

<div id="sidebar"> <!-- Sidebar -->

<div id="linkpool" > <!-- Links to main pages, id=linkpool-->
<table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc">Main pages</a></h3></div>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./install.html">Install</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./configuration.html">Configuration</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-search.html">RESTful API : Search</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-insert-update-delete.html">RESTful API : Insert/Update/Delete</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./restful-control.html">RESTful API : Control</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./geo.html">GEO Search</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./ranking.html">Ranking</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="./mongodb.html">MongoDB Search</a></br><br>
</td></tr></tbody></table>
<span ><a  href="http://www.srch2.com" target="_blankt"><img  style="width:100px" src="images/logo.png" /></a></span></br></br>
</div> <!-- Links to main pages, id=linkpool-->
<hr/>
<div id="content" > <!-- Table of content, id=content-->
<table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc">Content</a></h3></div>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#overview">1. Overview</a><br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#configTag">2. Config</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#srch2Home">3. SRCH2HOME</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#licenseFile">4. License File</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#listeningHostname">5. Hostname & Port</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataDir">6. Data Directory</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#data">7. Data Source Information</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataSources">7.1. Data Source Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#dataFile">7.2. Data File</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#mongodb">7.3. MongoDB</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#indexConfig">8. Index Config</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#indexType">8.1. Index Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fieldBoost">8.2. Field Boosts</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#recordBoostField">8.3. Record Boost Field</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#defaultQueryTermBoost">8.4. Default Query Term Boost</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryConfig">9. Query Parameters</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#rankingalgorithm">9.1. Ranking</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermSimilarityBoost">9.2. Term Similarity Boost</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermSimilarityThreshold">9.3. Term Similarity Threshold</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#supportSwapInEditDistance">9.4. Support Swap in Edit Distance</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermLengthBoost">9.5. Query Term Length Boost</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#prefixMatchPenalty">9.6. Prefix Match Penalty</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#cacheSize">9.7. Cache Size</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#rows">9.8. Rows to be returned</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#maxSearchThreads">9.9. Max Searcher Threads</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fieldBasedSearch">9.10. Enabling Field Based Search</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#searcherType">9.11. Search Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermMatchType">9.12. Term Match Type</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryTermType">9.13. Query Term Type</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#queryResponseWriter">10. Response Writer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#ResponseContent">10.1. Response Content</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#updateHandler">11. Update Handler</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#maxDocs">11.1. Max Documents</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#mergePolicy">11.2. Merge Policy</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#updateLog">11.3. Logging</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#logLevel">11.4. Log Level</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#accessLogFile">11.5. Log File</a></br><br>
&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#schemaTag">12. schema</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#uniqueKey">12.1. Primary Key</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#fields">12.2. Field Declaration</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#facetEnabled">12.3. Enable Facets</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#facetFields">12.4. Facet Field Declaration</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#analyzer">12.5. Analyzer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#PorterStemFilter">12.5.1 Stemmer</a></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="text-decoration: none;color:#3366FF" href="#StopFilter">12.5.2 Stop Words</a></br><br>
</td></tr></tbody></table>

</div> <!-- Table of content, id=content-->

</div> <!-- Sidebar -->

</td>

<td id="docBody" style="width:70%">
<br/>
<div><table><tbody><tr><td>
<div><h3><a style="text-decoration: none;color:#880000" href="#doc"></a></h3></div>

</td></tr></tbody></table></div>
<br/>
#<center>SRCH2 Documentation: Engine Configuration</center>#{id="doc" style="color:#880000" }
######<center>Version: 4.0, Date: September 19, 2013</center>{id="versionInfo" style="font-size: 12px; margin-top: -20px;"}

###1. Overview:###{id="overview"}
>The SRCH2 engine can be customized using a configuration file in XML. This documentation describes the details of how to do this configuration.


>The configuration file contains two top-level tags: "config" and "schema". The children of the "config" (e.g., "srch2home") tune the engine, while the children of the "schema" tag (e.g., "fields") describe the data. Each parameter can have one of the following two labels: "Required" means this tag has to be present in the configuration file, and "Optional" means this tag does not need to be present.

###2. Config Component:{id="configTag"}
> The following is a breakdown of the subtags of the "config" component.

####3. SRCH2 Home Directory, Required{id="srch2Home"}
```
<srch2Home>/path/to/srch2/home/directory</srch2Home>
```
> This parameter specifies the installation folder of the SRCH2 engine, which includes the binary, license file, and other files needed by the engine. Other file paths used in the configuration should be relative to this home path. For example, if we give the engine a data file at "/usr/joe/srch2/data/sample-data.json", and the SRCH2 home directory is set to "/usr/joe/srch2", then the configuration file should reference the data file's location as "data/sample-data.json".

####4. License Key File, Required{id="licenseFile"}
```
<licenseFile>/path/to/srch2_license_key.txt</licenseFile>
```
>It specifies a license key file required by the engine. Email <EMAIL> to get a key file. You can also fill in a [form](http://srch2.com/try.php) to get a free trial key. <br>


####5. Hostname and Port, Required{id="listeningHostname"}
```
<listeningHostname>127.0.0.1</listeningHostname>
<listeningPort>8081</listeningPort>
```
> Hostname is the IP address, redirect specified in iptables, or masking name specified in the /etc/hostname which the client will use to reach this server.<br>
> Specify as 0.0.0.0 if value is unknown.

####6. Data Directory, Required{id="dataDir"}
```
<dataDir>/path/to/data/directory/</dataDir>
```
> It specifies the path of a folder where the engine stores serialized index files. <br>



####7. Data {id="data"}

>####7.1. Data Sources, Optional {id="dataSources"}

```
<dataSourceType>1</dataSourceType>
```
>> It specifies the type of data source to build the indexes from.

>>>        1 - json data file. (Default)
>>>        2 - Mongo Db.

>####7.2. Data File, Required if "dataSourceType" is 1 {id="dataFile"}

```
<dataFile>/path/to/data.json</dataFile>
```
>> It specifies a JSON data file to be loaded by the engine.<br>

>####7.3. MongoDB, Required if "dataSourceType" is 2 {id="mongodb"}
```
<mongodb>
    <host>www.my-company.com</host>
    <port>1234</port>
    <db>database-name</db>
    <collection>collection-name</collection>
    <listenerWaitTime>3</listenerWaitTime>
</mongodb> 
```
>> It specifies MongoDB instance information.
>> Note: listenerWaitTime must be specified in seconds. It specifies how frequently SRCH2 engine is updated from your MongoDB instance (e.g., every 3 seconds). 

####8. Index Config:{id="indexConfig"}
> This tag includes parameters related to customizing the indexes.
```
<indexConfig>
...
</indexConfig>
```
>####8.1. Index Type, Required{id="indexType"}
```
<indexType>0</indexType>
```
>> 0: Text Indexes; <br>
>> 1: Text + Geo Indexes, which support location-based search. <br>


>####8.2. Field Boosts, Optional{id="fieldBoost"}
```
<fieldBoost></fieldBoost>
```
>> It specifies boost values for the <a href="#fields">searchable attributes</a>. A boost value is in the range [1,100]. If the value is outside the range, it will be set to 1. For example, the boost values for three searchable attributes can be specified as: <br>
```
<fieldBoost>relevance^10 name^7 title</fieldBoost>
```
>> Notice that the fields are sparated by a single white space. If a value is not provide for a field, the engine uses a default value of 1.<br>


>####8.3. Record Boost Field, Optional{id="recordBoostField"}
```
<recordBoostField>relevance</recordBoostField>
```
>> It specifies an attribute whose value is used as the boost value of a record's score. The attribute needs to be of float type.
>####8.4. Default Query Term Boost, Optional{id="defaultQueryTermBoost"}
```
<defaultQueryTermBoost>1</defaultQueryTermBoost>
```
>> It specifies a default [query term boost](configuration.html##Boosting a term). If the parameter is not given, the engine uses 1 as the default value.<br>


####9. Query parameters:{id="queryConfig"}
> The following tag includes parameters related to queries.
```
<query>
...
</query>
```
>####9.1. Ranking:{id="rankingalgorithm"}

>> The following tags and parameters are related to ranking. See http://www.srch2.com/download.html for ranking-related information.

```
<rankingalgorithm>
<recordScoreExpression>idf_score*doc_boost</recordScoreExpression>
</rankingalgorithm>
```

>####9.2. Term Similarity Boost, Optional{id="queryTermSimilarityBoost"}

```
<queryTermSimilarityBoost>0.9</queryTermSimilarityBoost>
```
>> It specifies a similarity boost used in computing the score of a record in fuzzy search. See the [fuzzy matched keywords](querysyntax.html#Fuzzy Searches) section about how this parameter is used. Its default value is 0.5.

>####9.3. Term Similarity Threshold, Optional{id="queryTermSimilarityThreshold"}
```
<queryTermSimilarityThreshold>0.5</queryTermSimilarityThreshold>
```
>> It modifies the default behavior of [fuzzy match keyword search](querysyntax.html#Fuzzy Searches). Its value must lie in [0,1] with 1 representing exact match, and 0 being the largest possible search neighbourhood. Its default value is 0.5.

>####9.4. Support Swap in Edit-distance operations, Optional{id="supportSwapInEditDistance"}
```
<supportSwapInEditDistance>true</supportSwapInEditDistance>
```
>> It specifies we 'swap' should be considered an edit-distance operation or not. By default edit-distance calculator uses insertion, deletion, substitution and swap.

>####9.5. Query Term Length Boost, Optional{id="queryTermLengthBoost"}
```
<queryTermLengthBoost></queryTermLengthBoost>
```
>>Check [the ranking section](ranking.html) to see how this value is used in the ranking function. Its default value is 0.5. <br>


>####9.6. Prefix Match Penalty, Optional{id="prefixMatchPenalty"}

```
<prefixMatchPenalty>0.95</prefixMatchPenalty>
```
>> It specifies the penalty for a prefix match. This value reduces, by a multiple, the score of a record with a prefix matched term. <br>
>> The value should be in the range of 0 to 1. its default value is 0.95. See [the ranking section](ranking.html) <br>


>####9.7. Cache Size, Optional{id="cacheSize"}

```
<cacheSize>65536000</cacheSize>
```
>> It specifies the number of bytes used in caching. The number should be in the range [50MB, 500MB] ([52428800,524288000]). Its default value is 52428800. <br>

>####9.8. Default value for number of returned results, Optional{id="rows"}
```
<rows>10</rows>
```
>> It specifies the number of results retrieved. Its defaults value is 10. <br>

>####9.9. Maximum number of search threads, Optional:{id="maxSearchThreads"}
```
<maxSearchThreads>2</maxSearchThreads>
```
>> It specifies the number of threads that serve search requests. Its default value is 1. <br>

>####9.10. Field Based Search Enabled, Optional{id="fieldBasedSearch"}
```
<fieldBasedSearch>0</fieldBasedSearch>
```
>>> It is a flag to toggle attribute-based search. An attribute-based search has conditions on which attributes a keyword needs to appear in.<br>
>>>> 0 - Disabled <br>
>>>> 1 - Enabled <br>
>>>> Note that if field-based search is enabled, the number of searchable attributes as specified in <a href='#fields'>fields</a> is limited to 31.


>####9.11. Search Type, Optional{id="searcherType"}
```
<searcherType>0</searcherType>
```
>> It sets the default search type of a query to the engine. <br>
>>> 0: finding the top relevant results; <br>
>>> 1: finding all matching results. <br>
>Its default value is 0.<br>

>####9.12. Query Term Match Type, Optional{id="queryTermMatchType"}
```
<queryTermMatchType>1</queryTermMatchType>
```
>> It modifies the default search behavior of the engine
>>> 0: exact match search;<br>
>>> 1: fuzzy match search.<br>
>>> Its default value is 0.

>####9.13. Query Term Type, Optional{id="queryTermType"}

```
<queryTermType>0</queryTermType>
```
>> It modifies the default treatment of search query's keyword:<br>
>>> 0: the term is treated as a prefix; <br>
>>> 1: the term is treated as a complete term; <br>
>> Its default value is 0.


>####10. Response Writer:{id="queryResponseWriter"}
>> This tag has parameters related to configuring the response of a query.
```
<queryResponseWriter>
...
</queryResponseWriter>
```

>>####10.1. Response Content, Optional{id="ResponseContent"}
```
<responseContent type="2">lat,lng</responseContent>
```
>>>or

```
<responseContent type="0"></responseContent>
```
>>> It specifies the format of each json search response. You should set the type to one of the following options: <br>
>>>> 0: format "rid,edit_dist,matching_prefix,in_memory_record"; <br>
>>>> 1: format "rid,edit_dist,matching_prefix". <br>
>>>> 2: format "rid,edit_dist,matching_prefix,fields_to_return". <br>
>>>> Its default value is 0. <br>
>>>> It is REQUIRED to include a comma separated list of fields in the tag if it is 2 <br>
>>>> <br>

####11. Update Handler:{id="updateHandler"}
> This tag includes tags related to configuring the engine to handle update requests.
```
<updatehandler>
...
</updatehandler>
```
>####11.1. Maximum Number of Documents, Required{id="maxDocs"}
```
<maxDocs>15000000</maxDocs>
```
>> It specifies the maximum number of records indexable by the engine. Inserting more records than the specified here will cause the insertions to fail.
>####11.2. Merge Policy, Required{id="mergePolicy"}

```
<mergePolicy>
<mergeEveryNSeconds>10</mergeEveryNSeconds>
<mergeEveryMWrites>100</mergeEveryMWrites>
</mergePolicy>
```
>> "mergeEveryNSeconds": The engine uses a background thread to periodically merge the data changes to the indexes. This parameter sets the number of seconds this background sleeps before it wakes up and does the merge. Note that decreasing this number will increase latency in the engine's response time.
>> mergeEveryMWrites: <br>
>> "mergeEveryMWrites": Another event that can trigger the background thread to do the merge is the number of data changes (inserts, deletes, and updates). This parameter specifies the number of record changes that can wake up the thread to do the merge. <br>

>####11.3. Logging:{id="updateLog"}
>> The following tag includes parameters related to logging in SRCH2.
```
<updateLog>
...
</updateLog>
```
>>####11.4. Log Level, Optional{id="logLevel"}
```
<logLevel>3</logLevel>
```
>>> The parameter decides the amount of feedback information the engine will report in its log. <br>
>>>> 0: SILENT <br>
>>>> 1: ERROR <br>
>>>> 2: WARNING <br>
>>>> 3: INFO <br>
>>> Its default value is 3.

>>####11.5. Log File, Required:{id="accessLogFile"}
```
<accessLogFile>./data/faceted_search/log.txt</accessLogFile>
```
>>> It specifies the file to which the engine writes logging information.<br>


###12. Schema Component:{id="schemaTag"}
> The following sections explain each subtag under the <i>schema</i> component.
```
<schema name="SRCH2" version="3">
...
</schema>
```

####12.1. Primary Key:{id="uniqueKey"}
> Primary Key: Required
```
<uniqueKey>id</uniqueKey>
```
> It specifies the attribute used as the primary key to reference each record in the data. If a inserted record has a primary key conflicting with an existing record, the new record will be rejected by the engine. The attribute needs to be of text type.<br>

####12.2. Fields, Required{id="fields"}
```
<fields>
...
</fields>
```
> This tag is a container of all field-related tags.

```
<field name="category" type="text" indexed="true" />
<field name="name" type="text" indexed="true" />
<field name="model" default="benz" required="true" type="text" indexed="false"/>
<field name="price" default="200" required="true" type="float" indexed="false"/>
<field name="likes" default="0" required="true" type="integer" indexed="false"/>
```
> These parameters give information about each field, including its name, type, and certain properties. <br>

> "name" : the name of the field<br>
> "type" : the type of the field. Supported types are:<br>
>> - Text<br>
>> - integer<br>
>> - float<br>
>> - time<br>
>> - location_longtitude (For Geo search)<br>
>> - location_latitude (For Geo search)<br>

>> The engine supports the following formats of time and date: <br>
>>> HH:MM:SS<br>
>>> MM/DD/YY<br>
>>> YY-MM-DD HH:MM::SS<br>
>>> YYMMDDHHMMSS<br>
>>> YYMMDDHHMM<br>
>>> YYMMDD<br>

>>> The engine supports the following formats of time duration: <br>
>>> {An integer}{A date/time constant}, in which date and time constants are: <br>
>>> SECOND,SECONDS,MINUTE,MINUTES,HOUR,HOURS,DAY,DAYS,WEEK,WEEKS,MONTH,MONTHS,YEAR,YEARS<br>
>>> Examples are: "DAY" (meaning 1 day) or "34WEEKS" (meaning 34 weeks).<br>

> Each field has certain properties:<br>
>> "required": The flag indicates whether this field can be empty or not. It is false by default.<br>
>> "default" : It gives the default value of this field if the value is missing.<br>
>> "searchable" : If it is true, then the engine will include its values in the indexes to support keyword search on this field.<br>
>> "refining" : If it is true, then the engine will include its values in the indexes to support postprocessing operations on query results, such as additional filtering predicates (e.g., "price < 20"), sort, and facet.<br>
>> "indexed": If this flag is true, then the engine will treat it as both a searchable and a refining attribute. <br>
> Note:<br>
>> - For geo search, two fields are required with the types location_latitude and location_longitude, respectively. The values of these geo fields should be float in the data file.<br>
>> - The primary key is optional to be included here. It can also be searchable and/or refining.<br>
>> - There must be at least one searchable field.

####12.3. Enable Facet:{id="facetEnabled"}
> Facet enabled flag <br>
> **Optional** <br>
> Toggles faceted search feature.<br>
```
<facetEnabled>true</facetEnabled>start
```
> - values are false (disabled) and true (enabled)<br>
> - By default it is disabled.<br>


####12.4. Facet Fields:{id="facetFields"}
> This tag contains all facet-related tags.
```
<facetFields>
...
</facetFields>
```
> Facet fields: Required if facet is enabled <br>
```
<facetField name="likes" facetType="range" facetStart="0" facetEnd="50" facetGap="10" />
<facetField name="model" facetType="categorical" />
<facetField name="price" facetType="range" facetStart="0" facetEnd="100" facetGap="10" />
```
>> - name: The name of the field used for this facet. It must correspond with a refining field specified in the <a href=#fields>field tag</a>. <br>
>> - facetType: Facet type, which is either categorical or range. <br>
>> - facetStart: The start point of making range facets. It is required for a range facet. The value will be ignored for categorical facets. <br>
>> - facetEnd: The end point of a range facet. It is required for a range facet. The value will be ignored for categorical facets. <br>
>> - facetGap: The increment amount used for making demarking a range facet. It is required for a range facet. The value will be ignored for categorical facets. <br>
>>> Note: fact ranges are created in correspondence with the "facetStart" value, not the "facetEnd" value. Therefore, the last interval may not stretch the entire facetGap. Also all facet fields must be declared in <a href=#fields>fields tag</a> as well (with refining="true") <br>

####12.5. Analyzer:{id="analyzer"}
> It specifies the analyzer used by the engine. <br>
```
<types>
<fieldType name="text_en">
<analyzer>
...
</analyzer>
</fieldType>
</types>
```
>>####12.5.1 Stemmer, Optional{id="PorterStemFilter"}
>>The engine supports [Porter Stemming](http://tartarus.org/martin/PorterStemmer/). It uses a dictionary file with keywords that should be ignored by the stemmer. If no file if provided, the stemmer is disabled.
```
<filter name="PorterStemFilter" dictionary="stemmer-dictionary.txt" />
```
>>####12.5.2 Stop Words, Optional{id="StopFilter"}
>> It specifies a file of stop words that can be ignored by the engine. Providing "" for "words" option can disable this filter.
```
<filter name="StopFilter" words="stop-words.txt" />
```
<hr/>
Have fun SRCHing!


<link rel="stylesheet" type="text/css" href="documentation.css">



<script type="text/javascript" src="setSizes.js"></script>
<script>

setSizes();
window.onresize = setSizes
</script>
{'fraction_non_alphanumeric': 0.18226320135257343, 'fraction_numerical': 0.025793260724255886, 'mean_word_length': 6.185619437773697, 'pattern_counts': {'":': 8, '<': 1014, '<?xml version=': 0, '>': 1606, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '957564', 'n_tokens_mistral': 17478, 'n_tokens_neox': 15952, 'n_words': 4772}