My bad. I misunderstood what you wanted. 

The example I gave was for the searching side of things. Not the data
representation in the document.

-Todd

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



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

Thanks. I did it exactly like you said.

I created a fieldType "ex" (short for experiment), defined
corresponding <copyFiled> and try it on the analysis page. Here is what
I got (I uploaded the page, so you can see it): 

http://tut-i-tam.com.ua/static/analysis.jsp.htm

I want the final token "samsung spinpoint p spn hard drive gb ata" to
be the actual "ex" value. So I expect such response:

<result name="response" numFound="1" start="0">
        <doc>
             <str name="ex">samsung spinpoint p spn hard drive gb
ata</str>
             <str name="id">SP2514N</str>
             <str name="description">Samsung SpinPoint12 P120 SP2514N -
hard drive - 250 GB - ATA-133</str>
             </doc>
</result>

But when I'm searching this doc, I got this:

<result name="response" numFound="1" start="0">
        <doc>
             <str name="ex">Samsung SpinPoint12 P120 SP2514N - hard
drive - 250 GB - ATA-133</str>
             <str name="id">SP2514N</str>
             <str name="description">Samsung SpinPoint12 P120 SP2514N -
hard drive - 250 GB - ATA-133</str>
             </doc>
</result>

As you can see "description" and "ex" filed are identical.
The result of filter chain wasn't actually stored in the "ex" filed :(

Anyway, thank you :)

FT> -Todd

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


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

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

FT> So you are saying that I can tell to slor (using filedType) how solr
FT> 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
FT> type in
FT>> your schema with the filters you would like, and use that type for
FT> your
FT>> copy field. So, the field description would have it's old type, but
FT> 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.
FT> 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