Sorry for being that stupid. I've modified the wrong schema.

So the "solr.WordDelimiterFilterFactory" works as expected and solved my 
problem. I've added the line
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" 
generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" 
splitOnCaseChange="0" splitOnNumericChange="1"/>

to my schema and test is green.

Thanks all for helping me
Per


-------- Original-Nachricht --------
> Datum: Thu, 21 Jul 2011 09:53:23 +0200
> Von: "Per Newgro" <per.new...@gmx.ch>
> An: solr-user@lucene.apache.org
> Betreff: Re: How can i find a document by a special id?

> The problem is that i didn't store the mediacode in a field. Because the
> code is used frequently for getting the customer source.
> 
> So far i've found the "solr.WordDelimiterFilterFactory" which is (from
> Wiki) the way to go. The problem seems to be that i'm searching a "longer"
> string then i've indexed. I only index the numeric id (12345).
> But query string is BR12345. I don't get any results. Can i fine-tune
> the WDFF somehow? 
> 
> By using the admin/analysis.jsp 
> 
> Index Analyzer
> org.apache.solr.analysis.StandardTokenizerFactory
> {luceneMatchVersion=LUCENE_33}
> position      1
> term text     BR12345
> startOffset   0
> endOffset     7
> type  <ALPHANUM>
> org.apache.solr.analysis.StopFilterFactory {words=stopwords.txt,
> ignoreCase=true, enablePositionIncrements=true, luceneMatchVersion=LUCENE_33}
> position      1
> term text     BR12345
> startOffset   0
> endOffset     7
> type  <ALPHANUM>
> org.apache.solr.analysis.WordDelimiterFilterFactory {splitOnCaseChange=1,
> generateNumberParts=1, catenateWords=1, luceneMatchVersion=LUCENE_33,
> generateWordParts=1, catenateAll=0, catenateNumbers=1}
> position      1       2
> term text     BR      12345
> startOffset   0       2
> endOffset     2       7
> type  <ALPHANUM>      <ALPHANUM>
> org.apache.solr.analysis.LowerCaseFilterFactory
> {luceneMatchVersion=LUCENE_33}
> position      1       2
> term text     br      12345
> startOffset   0       2
> endOffset     2       7
> type  <ALPHANUM>      <ALPHANUM>
> Query Analyzer
> org.apache.solr.analysis.StandardTokenizerFactory
> {luceneMatchVersion=LUCENE_33}
> position      1
> term text     BR12345
> startOffset   0
> endOffset     7
> type  <ALPHANUM>
> org.apache.solr.analysis.StopFilterFactory {words=stopwords.txt,
> ignoreCase=true, enablePositionIncrements=true, luceneMatchVersion=LUCENE_33}
> position      1
> term text     BR12345
> startOffset   0
> endOffset     7
> type  <ALPHANUM>
> org.apache.solr.analysis.SynonymFilterFactory {synonyms=synonyms.txt,
> expand=true, ignoreCase=true, luceneMatchVersion=LUCENE_33}
> position      1
> term text     BR12345
> startOffset   0
> endOffset     7
> type  <ALPHANUM>
> org.apache.solr.analysis.WordDelimiterFilterFactory {splitOnCaseChange=1,
> generateNumberParts=1, catenateWords=0, luceneMatchVersion=LUCENE_33,
> generateWordParts=1, catenateAll=0, catenateNumbers=0}
> position      1       2
> term text     BR      12345
> startOffset   0       2
> endOffset     2       7
> type  <ALPHANUM>      <ALPHANUM>
> org.apache.solr.analysis.LowerCaseFilterFactory
> {luceneMatchVersion=LUCENE_33}
> position      1       2
> term text     br      12345
> startOffset   0       2
> endOffset     2       7
> type  <ALPHANUM>      <ALPHANUM>
> 
> My field type is here
> 
> schema.xml
>     <fieldType name="text_general" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer type="index">
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt" enablePositionIncrements="true" />
>         <!-- in this example, we will only use synonyms at query time -->
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="false"/>
>         <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="1" 
> catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="1"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt" enablePositionIncrements="true" />
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>               <filter class="solr.WordDelimiterFilterFactory" 
> generateWordParts="1"
> generateNumberParts="1" catenateWords="0" catenateNumbers="1" catenateAll="1"
> splitOnCaseChange="1"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>     </fieldType>
> 
> 
> Thanks
> Per
> 
> -------- Original-Nachricht --------
> > Datum: Wed, 20 Jul 2011 17:03:40 -0400
> > Von: Bill Bell <billnb...@gmail.com>
> > An: "solr-user@lucene.apache.org" <solr-user@lucene.apache.org>
> > CC: "solr-user@lucene.apache.org" <solr-user@lucene.apache.org>
> > Betreff: Re: How can i find a document by a special id?
> 
> > Why not just search the 2 fields?
> > 
> > q=*:*&fq=mediacode:AB OR id:123456
> > 
> > You could take the user input and replace it:
> > 
> > q=*:*&fq=mediacode:$input OR id:$input
> > 
> > Of course you can also use dismax and wrap with an OR.
> > 
> > Bill Bell
> > Sent from mobile
> > 
> > 
> > On Jul 20, 2011, at 3:38 PM, Chris Hostetter <hossman_luc...@fucit.org>
> > wrote:
> > 
> > > 
> > > : Am 20.07.2011 19:23, schrieb Kyle Lee:
> > > : > Is the mediacode always alphabetic, and is the ID always numeric?
> > > : > 
> > > : No sadly not. We expose our products on "too" many medias :-).
> > > 
> > > If i'm understanding you correctly, you're saying even the prefix "AB"
> > is 
> > > not special, that there could be any number of prefixes identifying 
> > > differnet "mediacodes" ? and the product ids aren't all numeric?
> > > 
> > > your question seems .... absurd.  
> > > 
> > > I can only assume that I am horribly missunderstanding your situation.
>  
> > > (which is very easy to do when you only have a single contrieved piece
> > of 
> > > example data to go on)
> > > 
> > > As a general rule, it's not a good idea to think about Solr in the
> same 
> > > way as a relational database, but Perhaps if you imagine for a moment
> > that 
> > > your Solr index *was* a (read only) relational database, with each 
> > > solr field corrisponding to a column in your DB, and then you
> described
> > in 
> > > psuedo-code/sql how you would go about doing the types of id lookups
> you
> > > want to do, it might give us a better idea of your situation so we can
> > > suggest an approach for dealing with it.
> > > 
> > > 
> > > -Hoss
> 
> -- 
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!             
> Jetzt informieren: http://www.gmx.net/de/go/freephone

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!               
Jetzt informieren: http://www.gmx.net/de/go/freephone

Reply via email to