Yes, using fieldType, you can have Solr run the PatternReplaceFilter for
you.

So, for example, you can declare something like this:
----------
<fieldType name="simpleText" class="solr.TextField" >  
...
</fieldType>

<fieldType name="strippedText" class="solr.TextField" >  
... Put the PatternReplaceFilter in here. At least for indexing, maybe
for query as well
</fieldType>
...
<field name="description" type="simpleText" stored="true"
indexed="true"/>
<field name="suggestion" type="strippedText" stored="true"
indexed="true"/>
...
<copyField source="description" destination="description"/> 
-----------

I would suggest doing this in your schema, then starting up Solr and
using the analysis admin page to see if it will index and search the way
you want. That way you don't have to pay the cost of actually indexing
the data to find out.

-Todd

-----Original Message-----
From: Aleksey Gogolev [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 22, 2008 9:24 AM
To: Feak, Todd
Subject: Re[2]: Question about copyField


Thanks for reply. I want to make your point more exact, cause I'm not
sure that I correctly understood you :)

As far as I know (correct me please, if I wrong) type defines the way
in which the field is indexed and queried. But I don't want to index
or query "suggestion" field in different way, I want "suggestion" field
store different value (like in example I wrote in first mail). 

So you are saying that I can tell to slor (using filedType) how solr
should process string before saving it? Yes?

FT> The filters and tokenizer that are applied to the copy field are
FT> determined by it's type in the schema. Simply create a new field
type in
FT> your schema with the filters you would like, and use that type for
your
FT> copy field. So, the field description would have it's old type, but
the
FT> field suggestion would get a new type.

FT> -Todd Feak

FT> -----Original Message-----
FT> From: Aleksey Gogolev [mailto:[EMAIL PROTECTED] 
FT> Sent: Wednesday, October 22, 2008 8:28 AM
FT> To: solr-user@lucene.apache.org
FT> Subject: Question about copyField


FT> Hello.

FT> I have field "description" in my schema. And I want make a filed
FT> "suggestion" with the same content. So I added following line to my
FT> schema.xml:

FT>    <copyField source="description" dest="suggestion"/>

FT> But I also want to modify "description" string before copying it to
FT> "suggestion" field. I want to remove all comas, dots and slashes.
Here
FT> is an example of such transformation:

FT> "TvPL/st, SAMSUNG, SML200"  => "TvPL st SAMSUNG SML200"

FT> And so as result I want to have such doc:

FT> <doc>
FT>      <field name="id">8asydauf9nbcngfaad</filed>
FT>      <field name="description">TvPL/st, SAMSUNG, SML200</filed>
FT>      <field name="description">TvPL st SAMSUNG SML200</filed>
FT> </doc>

FT> I think it would be nice to use solr.PatternReplaceFilterFactory for
FT> this purpose. So the question is: Can I use solr filters for
FT> processing "description" string before copying it to "suggestion"
FT> field?

FT> Thank you for your attention.




-- 
Aleksey Gogolev
developer, 
dev.co.ua
Aleksey                         mailto:[EMAIL PROTECTED]


Reply via email to