r1556 - in trunk: . wikitty-solr wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr wikitty-solr/src/main/resources
Author: bpoussin Date: 2013-02-28 21:52:12 +0100 (Thu, 28 Feb 2013) New Revision: 1556 Url: http://nuiton.org/projects/wikitty/repository/revisions/1556 Log: migrate to solr 4.1 and cleaning solrconfig.xml Removed: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrQueryParser.java Modified: trunk/pom.xml trunk/wikitty-solr/pom.xml trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryVisitorToSolr.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java trunk/wikitty-solr/src/main/resources/schema.xml trunk/wikitty-solr/src/main/resources/solrconfig.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/pom.xml 2013-02-28 20:52:12 UTC (rev 1556) @@ -62,6 +62,7 @@ <javassistVersion>3.8.0.GA</javassistVersion> <jspapiversion>2.1</jspapiversion> <opencsvVersion>2.3</opencsvVersion> + <solrVersion>4.1.0</solrVersion> <nuitonProcessessorVersion>1.2.2</nuitonProcessessorVersion> <nuiton-struts2>1.3</nuiton-struts2> @@ -205,7 +206,7 @@ <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-core</artifactId> - <version>3.5.0</version> + <version>${solrVersion}</version> <scope>compile</scope> <exclusions> <exclusion> @@ -218,7 +219,7 @@ <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> - <version>3.5.0</version> + <version>${solrVersion}</version> <scope>compile</scope> <exclusions> <exclusion> @@ -229,20 +230,6 @@ </dependency> <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - <version>3.5.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-analyzers</artifactId> - <version>3.5.0</version> - <scope>compile</scope> - </dependency> - - <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> Modified: trunk/wikitty-solr/pom.xml =================================================================== --- trunk/wikitty-solr/pom.xml 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/pom.xml 2013-02-28 20:52:12 UTC (rev 1556) @@ -53,14 +53,16 @@ <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> + <exclusions> + <exclusion> + <!-- https://issues.apache.org/jira/browse/SOLR-2487 --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </dependency> - - <dependency> <groupId>org.jboss.jbossts</groupId> <artifactId>jbossjta</artifactId> <scope>compile</scope> Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryVisitorToSolr.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryVisitorToSolr.java 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryVisitorToSolr.java 2013-02-28 20:52:12 UTC (rev 1556) @@ -135,19 +135,19 @@ */ private String fixSolrBug(String element2solr, String value) { String result = value; - if (element2solr.equals(WikittySolrConstant.SOLR_FULLTEXT) || - element2solr.startsWith(WikittySolrConstant.SOLR_FULLTEXT_ALL_EXTENSIONS) || - element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_FULLTEXT)|| - element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_LOWERCASE)) { // is string - // TODO poussin 20120107 impossible de comprendre pourquoi il faut force - // la chaine en lower case, ca devrait etre le role de solr/lucene via - // la description du schema de mettre la chaine dans la bonne forme - // pour la recheche en fonction du type du champs souhaite (ici fulltext) - // tant que ca marche pas on force a la main - // idem pour les accents :( - result = StringUtils.stripAccents(result); - result = result.toLowerCase(); - } +// if (element2solr.equals(WikittySolrConstant.SOLR_FULLTEXT) || +// element2solr.startsWith(WikittySolrConstant.SOLR_FULLTEXT_ALL_EXTENSIONS) || +// element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_FULLTEXT)|| +// element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_LOWERCASE)) { // is string +// // TODO poussin 20120107 impossible de comprendre pourquoi il faut force +// // la chaine en lower case, ca devrait etre le role de solr/lucene via +// // la description du schema de mettre la chaine dans la bonne forme +// // pour la recheche en fonction du type du champs souhaite (ici fulltext) +// // tant que ca marche pas on force a la main +// // idem pour les accents :( +// result = StringUtils.stripAccents(result); +// result = result.toLowerCase(); +// } return result; } @@ -723,7 +723,7 @@ @Override public void visit(False o) { - solrQuery += "( *:* - *:* )"; + solrQuery += "NOT(*:*)"; } @Override Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java 2013-02-28 20:52:12 UTC (rev 1556) @@ -40,7 +40,7 @@ public interface WikittySolrConstant { /** Precise the query parser to use, is allow leading wildcard */ - static final public String SOLR_QUERY_PARSER = "{!wikitty}"; + static final public String SOLR_QUERY_PARSER = "{!lucene}"; // "{!wikitty}"; /** * Prefix utiliser pour les champs ajouter lors de l'indexation. Ce prefix Deleted: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrQueryParser.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrQueryParser.java 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrQueryParser.java 2013-02-28 20:52:12 UTC (rev 1556) @@ -1,102 +0,0 @@ -/* - * #%L - * Wikitty :: wikitty-solr-impl - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.storage.solr; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.lucene.queryParser.ParseException; -import org.apache.lucene.queryParser.QueryParser; -import org.apache.lucene.search.Query; -import org.apache.solr.common.params.CommonParams; -import org.apache.solr.common.params.SolrParams; -import org.apache.solr.common.util.NamedList; -import org.apache.solr.request.SolrQueryRequest; -import org.apache.solr.search.LuceneQParserPlugin; -import org.apache.solr.search.QParser; -import org.apache.solr.search.QueryParsing; -import org.apache.solr.search.SolrQueryParser; - -/** - * Add allow leading wildcard - * setAllowLeadingWildcard(true); - * <br>Example: <code>{!wikitty q.op=AND df=text sort='price asc'}myfield:foo +bar -baz</code> - * More information @see LuceneQParserPlugin - */ -public class WikittySolrQueryParser extends LuceneQParserPlugin { - - public static String NAME = "wikitty"; - - @Override - public void init(NamedList args) { - } - - @Override - public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { - return new SolrQParser(qstr, localParams, params, req); - } - - static public class SolrQParser extends QParser { - - static private Log log = LogFactory.getLog(SolrQParser.class); - String sortStr; - SolrQueryParser lparser; - - public SolrQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { - super(qstr, localParams, params, req); - } - - @Override - public Query parse() throws ParseException { - - String defaultField = getParam(CommonParams.DF); - if (defaultField == null) { - // TODO poussin 20101216 normalement on devrait retrouver cette - // valeur dans la config. Mais en fait a chaque fois on passe - // ici car defaultField est null :( alors que dans schema.xml - // on a bien defini le defaultField :( - defaultField = WikittySolrConstant.SOLR_FULLTEXT; - } - - lparser = new SolrQueryParser(this, defaultField); - lparser.setAllowLeadingWildcard(true); - - String opParam = getParam(QueryParsing.OP); - if (opParam != null) { - lparser.setDefaultOperator("AND".equals(opParam) ? QueryParser.Operator.AND : QueryParser.Operator.OR); - } - - String qstr = getString(); - if (log.isDebugEnabled()) { - log.debug("Query parse : " + qstr); - } - return lparser.parse(qstr); - } - - @Override - public String[] getDefaultHighlightFields() { - return new String[]{lparser.getField()}; - } - } -} Modified: trunk/wikitty-solr/src/main/resources/schema.xml =================================================================== --- trunk/wikitty-solr/src/main/resources/schema.xml 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/src/main/resources/schema.xml 2013-02-28 20:52:12 UTC (rev 1556) @@ -145,7 +145,7 @@ <field name="#tree.depth" type="int" indexed="true" stored="true" multiValued="false"/> <field name="#tree.attached-all" type="string" indexed="true" stored="false" multiValued="true"/> <!-- copy all field (except binary) in '#fulltext' field for fulltext search --> - <field name="#fulltext" type="text" indexed="true" stored="false" multiValued="true"/> + <field name="#fulltext" type="text" indexed="true" stored="false" multiValued="true" compressed="true"/> <!-- to prevent error if we try to sort on no sortable field (multivalued) ATTENTION: solr ne prend pas l'ordre de definition, mais tri sur la longueur du @@ -192,12 +192,6 @@ --> <uniqueKey>#id</uniqueKey> - <!-- field for the QueryParser to use when an explicit fieldname is absent --> - <defaultSearchField>#fulltext</defaultSearchField> - - <!-- SolrQueryParser configuration: defaultOperator="AND|OR" --> - <solrQueryParser defaultOperator="AND"/> - <copyField source="#tree.attached.*" dest="#tree.attached-all"/> <copyField source="*_b" dest="#fulltext"/> @@ -219,4 +213,13 @@ <!-- copy String field for text indexed format version --> <copyField source="*_s" dest="*_s_t"/> + <!-- + | Suite passage solr 4.1.0 + | Parametre plus support dans ce fichier, il faut qu'il soit dans la + | definition du parser (dans solrconfig.xml) + | + | defaultSearchField: #fulltext + | solrQueryParser defaultOperator: AND + +--> + </schema> Modified: trunk/wikitty-solr/src/main/resources/solrconfig.xml =================================================================== --- trunk/wikitty-solr/src/main/resources/solrconfig.xml 2013-02-25 11:31:36 UTC (rev 1555) +++ trunk/wikitty-solr/src/main/resources/solrconfig.xml 2013-02-28 20:52:12 UTC (rev 1556) @@ -26,88 +26,64 @@ <config> - <luceneMatchVersion>LUCENE_35</luceneMatchVersion> + <luceneMatchVersion>LUCENE_41</luceneMatchVersion> - <!-- Set this to 'false' if you want solr to continue working after it has - encountered an severe configuration error. In a production environment, - you may want solr to keep working even if one handler is mis-configured. - - You may also set this to false using by setting the system property: - -Dsolr.abortOnConfigurationError=false - --> - <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError> - <!-- Used to specify an alternate directory to hold all index data other than the default ./data under the Solr home. If replication is in use, this should match the replication configuration. --> <dataDir>${wikitty.searchengine.solr.directory.data:./solr/data}</dataDir> <!-- The DirectoryFactory to use for indexes. - solr.StandardDirectoryFactory, the default, is filesystem based. - solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. - A prefix of "solr." for class names is an alias that - causes solr to search appropriate packages, including - org.apache.solr.(search|update|request|core|analysis) + + solr.StandardDirectoryFactory is filesystem + based and tries to pick the best implementation for the current + JVM and platform. solr.NRTCachingDirectoryFactory, the default, + wraps solr.StandardDirectoryFactory and caches small files in memory + for better NRT performance. + + One can force a particular implementation via solr.MMapDirectoryFactory, + solr.NIOFSDirectoryFactory, or solr.SimpleFSDirectoryFactory. + + solr.RAMDirectoryFactory is memory based, not + persistent, and doesn't work with replication. --> <directoryFactory name="DirectoryFactory" class="${wikitty.searchengine.solr.directory.factory:solr.StandardDirectoryFactory}"/> <directoryFactory name="IndexReaderFactory" class="${wikitty.searchengine.solr.indexReader.factory:solr.StandardIndexReaderFactory}"/> - <indexDefaults> - <!-- Values here affect all index writers and act as a default unless overridden. --> - <useCompoundFile>false</useCompoundFile> + <indexConfig> + <!-- LockFactory - <mergeFactor>10</mergeFactor> - <!-- - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. + This option specifies which Lucene LockFactory implementation + to use. - --> - <!--<maxBufferedDocs>1000</maxBufferedDocs>--> - <!-- Tell Lucene when to flush documents to disk. - Giving Lucene more memory for indexing means faster indexing at the cost of more RAM + single = SingleInstanceLockFactory - suggested for a + read-only index or when there is no possibility of + another process trying to modify the index. + native = NativeFSLockFactory - uses OS native file locking. + Do not use when multiple solr webapps in the same + JVM are attempting to share a single index. + simple = SimpleFSLockFactory - uses a plain file for locking - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. + Defaults: 'native' is default for Solr3.6 and later, otherwise + 'simple' is the default + More details on the nuances of each LockFactory... + http://wiki.apache.org/lucene-java/AvailableLockFactories --> - <ramBufferSizeMB>32</ramBufferSizeMB> - <maxMergeDocs>2147483647</maxMergeDocs> - <maxFieldLength>10000</maxFieldLength> - <writeLockTimeout>1000</writeLockTimeout> - <commitLockTimeout>10000</commitLockTimeout> + <lockType>${wikitty.searchengine.solr.lockType:single}</lockType> - <!-- - This option specifies which Lucene LockFactory implementation to use. - - single = SingleInstanceLockFactory - suggested for a read-only index - or when there is no possibility of another process trying - to modify the index. - native = NativeFSLockFactory - simple = SimpleFSLockFactory + <!-- Unlock On Startup - (For backwards compatibility with Solr 1.2, 'simple' is the default - if not specified.) - --> - <lockType>single</lockType> - </indexDefaults> - - <mainIndex> - <!-- options specific to the main on-disk lucene index --> - <useCompoundFile>false</useCompoundFile> - <ramBufferSizeMB>32</ramBufferSizeMB> - <mergeFactor>10</mergeFactor> - <!-- Deprecated --> - <!--<maxBufferedDocs>1000</maxBufferedDocs>--> - <maxMergeDocs>2147483647</maxMergeDocs> - <maxFieldLength>10000</maxFieldLength> - - <!-- If true, unlock any held write or commit locks on startup. + If true, unlock any held write or commit locks on startup. This defeats the locking mechanism that allows multiple - processes to safely access a lucene index, and should be - used with care. - This is not needed if lock type is 'none' or 'single' + processes to safely access a lucene index, and should be used + with care. Default is "false". + + This is not needed if lock type is 'single' --> - <unlockOnStartup>true</unlockOnStartup> - </mainIndex> + <unlockOnStartup>${wikitty.searchengine.solr.unlockOnStartup:true}</unlockOnStartup> + </indexConfig> <!-- Enables JMX if and only if an existing MBeanServer is found, use this if you want to configure JMX through JVM parameters. Remove @@ -132,60 +108,90 @@ <!-- Maximum number of clauses in a boolean query (default: 1024). can affect range or prefix queries that expand to big boolean queries. An exception is thrown if exceeded. --> + <!-- wikitty need large value to work --> <maxBooleanClauses>2147483647</maxBooleanClauses> - <!-- Cache used by SolrIndexSearcher for filters (DocSets), - unordered sets of *all* documents that match a query. - When a new searcher is opened, its caches may be prepopulated - or "autowarmed" using data from caches in the old searcher. - autowarmCount is the number of items to prepopulate. For LRUCache, - the autowarmed items will be the most recently accessed items. - Parameters: - class - the SolrCache implementation (currently only LRUCache) - size - the maximum number of entries in the cache - initialSize - the initial capacity (number of entries) of - the cache. (seel java.util.HashMap) - autowarmCount - the number of entries to prepopulate from - and old cache. - --> + <!-- Solr Internal Query Caches + + There are two implementations of cache available for Solr, + LRUCache, based on a synchronized LinkedHashMap, and + FastLRUCache, based on a ConcurrentHashMap. + + FastLRUCache has faster gets and slower puts in single + threaded operation and thus is generally faster than LRUCache + when the hit ratio of the cache is high (> 75%), and may be + faster under other scenarios on multi-cpu systems. + --> + + <!-- Filter Cache + + Cache used by SolrIndexSearcher for filters (DocSets), + unordered sets of *all* documents that match a query. When a + new searcher is opened, its caches may be prepopulated or + "autowarmed" using data from caches in the old searcher. + autowarmCount is the number of items to prepopulate. For + LRUCache, the autowarmed items will be the most recently + accessed items. + + Parameters: + class - the SolrCache implementation LRUCache or + (LRUCache or FastLRUCache) + size - the maximum number of entries in the cache + initialSize - the initial capacity (number of entries) of + the cache. (see java.util.HashMap) + autowarmCount - the number of entries to prepopulate from + and old cache. + --> <filterCache - class="solr.LRUCache" + class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/> - <!-- queryResultCache caches results of searches - ordered lists of - document ids (DocList) based on a query, a sort, and the range - of documents requested. --> + <!-- Query Result Cache + + Caches results of searches - ordered lists of document ids + (DocList) based on a query, a sort, and the range of documents requested. + --> <queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/> - <!-- documentCache caches Lucene Document objects (the stored fields for each document). - Since Lucene internal document ids are transient, this cache will not be autowarmed. --> + <!-- Document Cache + + Caches Lucene Document objects (the stored fields for each + document). Since Lucene internal document ids are transient, + this cache will not be autowarmed. + --> <documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/> - <!-- If true, stored fields that are not requested will be loaded lazily. + <!-- Lazy Field Loading - This can result in a significant speed improvement if the usual case is to - not load all stored fields, especially if the skipped fields are large compressed - text fields. + If true, stored fields that are not requested will be loaded + lazily. This can result in a significant speed improvement + if the usual case is to not load all stored fields, + especially if the skipped fields are large compressed text + fields. --> + --> <enableLazyFieldLoading>true</enableLazyFieldLoading> - <!-- An optimization for use with the queryResultCache. When a search - is requested, a superset of the requested number of document ids - are collected. For example, if a search for a particular query - requests matching documents 10 through 19, and queryWindowSize is 50, - then documents 0 through 49 will be collected and cached. Any further - requests in that range can be satisfied via the cache. --> + <!-- Result Window Size + + An optimization for use with the queryResultCache. When a search + is requested, a superset of the requested number of document ids + are collected. For example, if a search for a particular query + requests matching documents 10 through 19, and queryWindowSize is 50, + then documents 0 through 49 will be collected and cached. Any further + requests in that range can be satisfied via the cache. + --> <!-- | Code Lutin | 1 si Wikitty est plus utilise pour de l'ecriture que de la lecture @@ -217,11 +223,25 @@ </query> - <!-- - Let the dispatch filter handler /select?qt=XXX - handleSelect=true will use consistent error handling for /select and /update - handleSelect=false will use solr1.1 style error formatting - --> + <!-- Request Dispatcher + + This section contains instructions for how the SolrDispatchFilter + should behave when processing requests for this SolrCore. + + handleSelect is a legacy option that affects the behavior of requests + such as /select?qt=XXX + + handleSelect="true" will cause the SolrDispatchFilter to process + the request and dispatch the query to a handler specified by the + "qt" param, assuming "/select" isn't already registered. + + handleSelect="false" will cause the SolrDispatchFilter to + ignore "/select" requests, resulting in a 404 unless a handler + is explicitly registered with the name "/select" + + handleSelect="true" is not recommended for new users, but is the default + for backwards compatibility + --> <requestDispatcher handleSelect="true" > <!--Make sure your system has some authentication before enabling remote streaming! --> <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" /> @@ -241,10 +261,13 @@ If no qt is defined, the requestHandler that declares default="true" will be used. --> - <requestHandler name="standard" class="solr.SearchHandler" default="true"> + <requestHandler name="/select" class="solr.SearchHandler" default="true"> <!-- default values for query parameters --> <lst name="defaults"> <str name="echoParams">explicit</str> + <str name="defType">lucene</str> + <str name="q.op">AND</str> + <str name="df">#fulltext</str> <!-- <int name="rows">10</int> <str name="fl">*</str> @@ -253,205 +276,6 @@ </lst> </requestHandler> - - <!-- DisMaxRequestHandler allows easy searching across multiple fields - for simple user-entered phrases. It's implementation is now - just the standard SearchHandler with a default query type - of "dismax". - see http://wiki.apache.org/solr/DisMaxRequestHandler - --> - <requestHandler name="dismax" class="solr.SearchHandler" > - <lst name="defaults"> - <str name="defType">dismax</str> - <str name="echoParams">explicit</str> - <float name="tie">0.01</float> - <str name="qf"> - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - </str> - <str name="pf"> - text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9 - </str> - <str name="bf"> - ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3 - </str> - <str name="fl"> - id,name,price,score - </str> - <str name="mm"> - 2<-1 5<-2 6<90% - </str> - <int name="ps">100</int> - <str name="q.alt">*:*</str> - <!-- example highlighter config, enable per-query with hl=true --> - <str name="hl.fl">text features name</str> - <!-- for this field, we want no fragmenting, just highlighting --> - <str name="f.name.hl.fragsize">0</str> - <!-- instructs Solr to return the field itself if no query terms are - found --> - <str name="f.name.hl.alternateField">name</str> - <str name="f.text.hl.fragmenter">regex</str> <!-- defined below --> - </lst> - </requestHandler> - - <!-- Note how you can register the same handler multiple times with - different names (and different init parameters) - --> - <!-- - poussin 20101224 - je ne vois pas trop a quoi ca sert. Je pense que c juste un exemple - <requestHandler name="partitioned" class="solr.SearchHandler" > - <lst name="defaults"> - <str name="defType">dismax</str> - <str name="echoParams">explicit</str> - <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str> - <str name="mm">2<-1 5<-2 6<90%</str> - < ! - - This is an example of using Date Math to specify a constantly - moving date range in a config... - - - > - <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str> - </lst> - < ! - - In addition to defaults, "appends" params can be specified - to identify values which should be appended to the list of - multi-val params from the query (or the existing "defaults"). - - In this example, the param "fq=instock:true" will be appended to - any query time fq params the user may specify, as a mechanism for - partitioning the index, independent of any user selected filtering - that may also be desired (perhaps as a result of faceted searching). - - NOTE: there is *absolutely* nothing a client can do to prevent these - "appends" values from being used, so don't use this mechanism - unless you are sure you always want it. - - - > - <lst name="appends"> - <str name="fq">inStock:true</str> - </lst> - <! - - "invariants" are a way of letting the Solr maintainer lock down - the options available to Solr clients. Any params values - specified here are used regardless of what values may be specified - in either the query, the "defaults", or the "appends" params. - - In this example, the facet.field and facet.query params are fixed, - limiting the facets clients can use. Faceting is not turned on by - default - but if the client does specify facet=true in the request, - these are the only facets they will be able to see counts for; - regardless of what other facet.field or facet.query params they - may specify. - - NOTE: there is *absolutely* nothing a client can do to prevent these - "invariants" values from being used, so don't use this mechanism - unless you are sure you always want it. - - - > - <lst name="invariants"> - <str name="facet.field">cat</str> - <str name="facet.field">manu_exact</str> - <str name="facet.query">price:[* TO 500]</str> - <str name="facet.query">price:[500 TO *]</str> - </lst> - </requestHandler> - --> - - - <!-- - Search components are registered to SolrCore and used by Search Handlers - - By default, the following components are avaliable: - - <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" /> - <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" /> - <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" /> - <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" /> - <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" /> - - Default configuration in a requestHandler would look like: - <arr name="components"> - <str>query</str> - <str>facet</str> - <str>mlt</str> - <str>highlight</str> - <str>debug</str> - </arr> - - If you register a searchComponent to one of the standard names, that will be used instead. - To insert handlers before or after the 'standard' components, use: - - <arr name="first-components"> - <str>myFirstComponentName</str> - </arr> - - <arr name="last-components"> - <str>myLastComponentName</str> - </arr> - --> - - <!-- The spell check component can return a list of alternative spelling - suggestions. --> - <!-- - poussin 20101224 - pas besoin du spell check, et surtout il cree des repertoires, donc - pour le in memory c'est pas super. Si on ne veut pas qu'il cree de repertoire - il faut que les *Dir soit null. Dans ce cas il utilise des RAMDirectory - <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> - - <str name="queryAnalyzerFieldType">textSpell</str> - - <lst name="spellchecker"> - <str name="name">default</str> - <str name="field">spell</str> - <str name="spellcheckIndexDir">./spellchecker1</str> - - </lst> - <lst name="spellchecker"> - <str name="name">jarowinkler</str> - <str name="field">spell</str> - <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str> - <str name="spellcheckIndexDir">./spellchecker2</str> - - </lst> - - <lst name="spellchecker"> - <str name="classname">solr.FileBasedSpellChecker</str> - <str name="name">file</str> - <str name="sourceLocation">spellings.txt</str> - <str name="characterEncoding">UTF-8</str> - <str name="spellcheckIndexDir">./spellcheckerFile</str> - </lst> - </searchComponent> - - < ! - - a request handler utilizing the spellcheck component - - > - <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler"> - <lst name="defaults"> - <str name="spellcheck.onlyMorePopular">false</str> - <str name="spellcheck.extendedResults">false</str> - <str name="spellcheck.count">1</str> - </lst> - <arr name="last-components"> - <str>spellcheck</str> - </arr> - </requestHandler> - --> - - <!-- a search component that enables you to configure the top results for - a given query regardless of the normal lucene scoring.--> - -<!-- poussin 20090902 remove elevate this file is empty, what need ? - <searchComponent name="elevator" class="solr.QueryElevationComponent" > - <str name="queryFieldType">string</str> - <str name="config-file">elevate.xml</str> - </searchComponent> - --> - <!-- a request handler utilizing the elevator component --> -<!-- - <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy"> - <lst name="defaults"> - <str name="echoParams">explicit</str> - </lst> - <arr name="last-components"> - <str>elevator</str> - </arr> - </requestHandler> - --> - <!-- Update request handler. Note: Since solr1.1 requestHandlers requires a valid content type header if posted in @@ -462,37 +286,19 @@ --> <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> - <!-- - Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful - for debugging and as a token server for other types of applications - --> - <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" /> + <!-- Admin Handlers + Admin Handlers - This will register all the standard admin + RequestHandlers. - <!-- CSV update handler, loaded on demand --> - <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" /> - - - <!-- - Admin Handlers - This will register all the standard admin RequestHandlers. Adding - this single handler is equivolent to registering: - - <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" /> - <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" /> - <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" /> - <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" /> - <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" /> - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > - - If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using: - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > - <lst name="invariants"> - <str name="hidden">synonyms.txt</str> - <str name="hidden">anotherfile.txt</str> - </lst> - </requestHandler> + "/admin/luke" + "/admin/system" + "/admin/plugins" + "/admin/threads" + "/admin/properties" + "/admin/file" --> - <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" /> + <requestHandler name="/admin/" class="solr.admin.AdminHandlers" /> <!-- ping/healthcheck --> <requestHandler name="/admin/ping" class="PingRequestHandler"> @@ -503,47 +309,10 @@ </lst> </requestHandler> - <!-- Echo the request contents back to the client --> - <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" > - <lst name="defaults"> - <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' --> - <str name="echoHandler">true</str> - </lst> - </requestHandler> - - - - - - - - -<!-- TODO JC 2011-04-12 Commented when migrating to solr 3.1.0. Is this useful ? --> -<!--Highlighting should be moved to searchComponents--> - <!-- <highlighting> - <!– Configure the standard fragmenter –> - <!– This could most likely be commented out in the "default" case –> - <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true"> - <lst name="defaults"> - <int name="hl.fragsize">100</int> - </lst> - </fragmenter> - - <!– A regular-expression-based fragmenter (f.i., for sentence extraction) –> - <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter"> - <lst name="defaults"> - <!– slightly smaller fragsizes work better because of slop –> - <int name="hl.fragsize">70</int> - <!– allow 50% slop on fragment sizes –> - <float name="hl.regex.slop">0.5</float> - <!– a basic sentence pattern –> - <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str> - </lst> - </fragmenter> - </highlighting>--> - +<!-- <queryParser name="lucene" class="org.nuiton.wikitty.storage.solr.WikittySolrQueryParser"/> <queryParser name="wikitty" class="org.nuiton.wikitty.storage.solr.WikittySolrQueryParser"/> +--> <!-- example of registering a query parser <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
participants (1)
-
bpoussin@users.nuiton.org