Created
November 18, 2010 14:43
-
-
Save hizel/705059 to your computer and use it in GitHub Desktop.
solr rulez
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
--> | |
<schema name="example" version="1.2"> | |
<types> | |
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> | |
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> | |
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> | |
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/> | |
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> | |
<analyzer> | |
<tokenizer class="solr.WhitespaceTokenizerFactory"/> | |
</analyzer> | |
</fieldType> | |
<fieldType name="text" class="solr.TextField" positionIncrementGap="100"> | |
<analyzer type="index"> | |
<tokenizer class="solr.HTMLStripWhitespaceTokenizerFactory"/> | |
<filter class="solr.StopFilterFactory" | |
ignoreCase="true" | |
words="stopwords.txt" | |
enablePositionIncrements="true" | |
/> | |
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.SnowballPorterFilterFactory" language="Russian"/> | |
</analyzer> | |
<analyzer type="query"> | |
<tokenizer class="solr.HTMLStripWhitespaceTokenizerFactory"/> | |
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> | |
<filter class="solr.StopFilterFactory" | |
ignoreCase="true" | |
words="stopwords.txt" | |
enablePositionIncrements="true" | |
/> | |
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.SnowballPorterFilterFactory" language="Russian"/> | |
</analyzer> | |
</fieldType> | |
<fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /> | |
</types> | |
<fields> | |
<field name="id" type="string" stored="true" required="true" /> | |
<field name="topic_id" type="int" stored="true" /> | |
<field name="comment_id" type="int" stored="true" /> | |
<field name="user" type="string" indexed="true" stored="true" /> | |
<field name="group" type="string" indexed="true" stored="true" /> | |
<field name="title" type="text" indexed="true" stored="true" /> | |
<field name="message" type="text" indexed="true" stored="true"/> | |
<field name="postdate" type="date" indexed="true" stored="true" /> | |
<field name="is_comment" type="boolean" indexed="true" stored="true" /> | |
</fields> | |
<uniqueKey>id</uniqueKey> | |
<defaultSearchField>message</defaultSearchField> | |
<solrQueryParser defaultOperator="OR"/> | |
</schema> | |
<dataConfig> | |
<dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/lor?characterEncoding=UTF-8" user="linuxweb" password="linuxweb"/> | |
<document name="messages"> | |
<entity name="message" query=" | |
select msgbase.id as id, | |
topics.id as topic_id, | |
0 as comment_id, | |
topics.title as title, | |
topics.postdate, | |
msgbase.message, | |
users.nick as user, | |
groups.title as group, | |
'f' as is_comment | |
from topics | |
join groups on (topics.groupid = groups.id) | |
join msgbase on (topics.id = msgbase.id) | |
join users on (topics.userid = users.id) | |
union | |
select msgbase.id as id, | |
topics.id as topic_id, | |
comments.id as comment_id, | |
comments.title as title, | |
comments.postdate as postdate, | |
msgbase.message as message, | |
users.nick as user, | |
groups.title as group, | |
't' as is_comment | |
from comments | |
join topics on ( comments.topic = topics.id) | |
join groups on ( topics.groupid = groups.id) | |
join msgbase on ( comments.id = msgbase.id ) | |
join users on ( comments.userid = users.id) | |
" /> | |
</document> | |
</dataConfig> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment