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.vupp...@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
>

Reply via email to