You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by stockii <st...@googlemail.com> on 2012/01/16 11:43:31 UTC

Replace Patter "," with ""

Why does this not work?

<fieldType name="city" class="solr.TextField">
    	<analyzer>
		        <charfilter class="solr.PatternReplaceFilterFactory" pattern="^(\,
)$" replacement="" replace="first" />
                                                 OR
 			<charfilter class="solr.PatternReplaceFilterFactory" pattern=", "
replacement="" replace="first" />
 			<tokenizer class="solr.WhitespaceTokenizerFactory" />
 		</analyzer>
    </fieldType>

i dont know where is my error?

i only want to replace comma with a blank ...

thx =)))

-----
------------------------------- System ----------------------------------------

One Server, 12 GB RAM, 2 Solr Instances, 8 Cores, 
1 Core with 45 Million Documents other Cores < 200.000

- Solr1 for Search-Requests - commit every Minute  - 5GB Xmx
- Solr2 for Update-Request  - delta every Minute - 4GB Xmx
--
View this message in context: http://lucene.472066.n3.nabble.com/Replace-Patter-with-tp3662813p3662813.html
Sent from the Solr - User mailing list archive at Nabble.com.

Solr 3.5 MoreLikeThis on Date fields

Posted by Jaco Olivier <ja...@sabinet.co.za>.
Hi Everyone,

Please help out if you know what is going on.
We are upgrading to Solr 3.5 (from 1.4.1) and busy with a Re-Index and Test on our data.

Everything seems OK, but Date Fields seem to be "broken" when using with the MoreLikeThis handler 
(I also saw the same error on Date Fields using the HighLighter in another forum post "Invalid Date String for highlighting any date field match @ Mon 2011/08/15 13:10 ").
* I deleted the index/core and only loaded a few records and still get the error when using the MoreLikeThis using the "docdate" as part of the mlt.fl params.
* I double checked all the data that was loaded and the dates parse 100% and can see no problems with any of the data loaded.

Type:         <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
Definition:   <field name="docdate" type="date" indexed="true" stored="true" multiValued="false"/>
A sample result: <date name="docdate">1999-06-28T00:00:00Z</date>

THE MLT QUERY:

Jan 16, 2012 4:09:16 PM org.apache.solr.core.SolrCore execute
INFO: [legal_spring] webapp=/solr path=/select params={mlt.fl=doctitle,pld_pubtype,docdate,pld_cluster,pld_port,pld_summary,alltext,subclass&mlt.mintf=1&mlt=true&version=2.2&fl=doc_id,doctitle,docdate,prodtype&qt=mlt&mlt.boost=true&mlt.qf=doctitle^5.0+alltext^0.2&json.nl=map&wt=json&rows=50&mlt.mindf=1&mlt.count=50&start=0&q=doc_id:PLD23996} status=400 QTime=1

THE ERROR:

Jan 16, 2012 4:09:16 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:'940464000000'
        at org.apache.solr.schema.DateField.parseMath(DateField.java:165)
        at org.apache.solr.analysis.TrieTokenizer.reset(TrieTokenizerFactory.java:106)
        at org.apache.solr.analysis.TrieTokenizer.<init>(TrieTokenizerFactory.java:76)
        at org.apache.solr.analysis.TrieTokenizerFactory.create(TrieTokenizerFactory.java:51)
        at org.apache.solr.analysis.TrieTokenizerFactory.create(TrieTokenizerFactory.java:41)
        at org.apache.solr.analysis.TokenizerChain.getStream(TokenizerChain.java:68)
        at org.apache.solr.analysis.SolrAnalyzer.reusableTokenStream(SolrAnalyzer.java:75)
        at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:385)
        at org.apache.lucene.search.similar.MoreLikeThis.addTermFrequencies(MoreLikeThis.java:876)
        at org.apache.lucene.search.similar.MoreLikeThis.retrieveTerms(MoreLikeThis.java:820)
        at org.apache.lucene.search.similar.MoreLikeThis.like(MoreLikeThis.java:629)
        at org.apache.solr.handler.MoreLikeThisHandler$MoreLikeThisHelper.getMoreLikeThis(MoreLikeThisHandler.java:311)
        at org.apache.solr.handler.MoreLikeThisHandler.handleRequestBody(MoreLikeThisHandler.java:149)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1372)
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)

Sincerely,
Jaco Olivier
Please note: This email and its content are subject to the disclaimer as displayed at the following link http://www.sabinet.co.za/?page=e-mail-disclaimer. Should you not have Web access, send an email to info@sabinet.co.za<ma...@sabinet.co.za> and a copy will be sent to you

Re: Replace Patter "," with ""

Posted by stockii <st...@googlemail.com>.
okay, thx =) 

but i replace it now in my data-config ;)

-----
------------------------------- System ----------------------------------------

One Server, 12 GB RAM, 2 Solr Instances, 8 Cores, 
1 Core with 45 Million Documents other Cores < 200.000

- Solr1 for Search-Requests - commit every Minute  - 5GB Xmx
- Solr2 for Update-Request  - delta every Minute - 4GB Xmx
--
View this message in context: http://lucene.472066.n3.nabble.com/Replace-Patter-with-tp3662813p3663027.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Replace Patter "," with ""

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
(12/01/16 19:43), stockii wrote:
> Why does this not work?
>
> <fieldType name="city" class="solr.TextField">
>      	<analyzer>
> 		<charfilter class="solr.PatternReplaceFilterFactory" pattern="^(\,
> )$" replacement="" replace="first" />
>                                                   OR
>   			<charfilter class="solr.PatternReplaceFilterFactory" pattern=", "
> replacement="" replace="first" />
>   			<tokenizer class="solr.WhitespaceTokenizerFactory" />
>   		</analyzer>
>      </fieldType>
>
> i dont know where is my error?
>
> i only want to replace comma with a blank ...

Try to:

1. use <char*F*ilter/> tag instead of <char*f*ilter/>
2. use PatternReplace*Char*FilterFactory instead of PatternReplaceFilterFactory

and you cannot use replace="first or all" with the CharFilter.
PatternReplaceFilter can accept replace because it just processes a token
each time, on the other hand, PatternReplaceCharFilterFactory should process
CharStream.

koji
-- 
http://www.rondhuit.com/en/