create and populate a field when building an index

Discussion in 'Java' started by Keith Beef, Oct 27, 2007.

  1. Keith Beef

    Keith Beef Guest

    I've been using the Lucene demo from
    http://lucene.apache.org/java/2_1_0/demo.html

    I have a set of documents
    with filenames that give a good indication of content.

    A filename of 12 digits (I think this is [0-9]{12} as a regular
    expression) with the extension html is a troubleshooting guide, the number
    being an error code. A filename with two or three letters, then a minus
    (which would be [a-z]{2,3}- I think), then a known string means the
    document is about a particular subject; I have a list of the known strings
    matched to subjects.

    What I would like to do, is have my indexer create a field named
    "category", populated with either the string "troubleshooting" or with the
    known string extracted from the filename.

    Examples:
    For a file named 0000000000111.html the indexer adds the field "category"
    with the value "troubleshooting". For a file named xxx-cal-123.html the
    indexer adds the field "category" with the value "cal". For a file named
    xx-qv-(9).html the indexer adds the field "category" with the value "qv".

    Is there a way to do that?

    Beef.
     
    Keith Beef, Oct 27, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick
    Replies:
    3
    Views:
    8,511
    Alexey Smirnov
    Apr 13, 2010
  2. Enjoy Life
    Replies:
    2
    Views:
    303
    Roland Hall
    Feb 23, 2005
  3. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    337
    Tomasz Chmielewski
    Mar 4, 2008
  4. Sound
    Replies:
    2
    Views:
    481
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    477
Loading...

Share This Page