lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Swapna Vuppala <Swapna.Vupp...@arup.com>
Subject RE: Trim and copy a solr field
Date Tue, 13 Dec 2011 05:05:06 GMT
Hi Juan,

Thanks for the reply. I tried using this, but I don't see any effect of the analyzer/filter.

I tried copying my Solr field to another field of the type defined below. Then I indexed couple
of documents with the new schema, but I see that both fields have got the same value.
Am looking at the indexed data in Luke.

Am assuming that analyzers process the field value (as specified by various filters etc) and
then store the modified value. Is that true ? What else could I be missing here ?

Thanks and Regards,
Swapna.

-----Original Message-----
From: Juan Grande [mailto:juan.grande@gmail.com] 
Sent: Monday, December 12, 2011 11:50 PM
To: solr-user@lucene.apache.org
Subject: Re: Trim and copy a solr field

Hi Swapna,

You could try using a copyField to a field that uses
PatternReplaceFilterFactory:

    <fieldType class="solr.TextField" name="path_location">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.PatternReplaceFilterFactory" pattern="(.*)/.*"
replacement="$1"/>
      </analyzer>
    </fieldType>

The regular expression may not be exactly what you want, but it will give
you an idea of how to do it. I'm pretty sure there must be some other ways
of doing this, but this is the first that comes to my mind.

*Juan*



On Mon, Dec 12, 2011 at 4:46 AM, Swapna Vuppala <Swapna.Vuppala@arup.com>wrote:

> Hi,
>
> I have a Solr field that contains the absolute path of the file that is
> indexed, which will be something like
> file://///myserver/Folder1/SubFol1/Sub-Fol2/Test.msg<file:///\\myserver\Folder1\SubFol1\Sub-Fol2\Test.msg>.
>
> Am interested in indexing the location in a separate field.  I was looking
> for some way to trim the field value from last occurrence of char "/", so
> that I can get the location value, something like
> file://///myserver/Folder1/SubFol1/Sub-Fol2<file:///\\myserver\Folder1\SubFol1\Sub-Fol2>,
> and store it in a new field. Can you please suggest some way to achieve
> this ?
>
> Thanks and Regards,
> Swapna.
> ____________________________________________________________
> Electronic mail messages entering and leaving Arup  business
> systems are scanned for acceptability of content and viruses
>

Mime
View raw message