Hi,



Using lucene.net we need to perform filtered search on xml files.

Filter should be on xml tags.



Example -



If the XML files contains following kind of data -



<?xml version="1.0"?>

<empID>10</empID>

<empName>Sudhanya</empName>

<empDept>Development</empDept>





For such a collection of XML files if I want to perform a search like-

Find all employes where empDept = "Development"



How can I achieve this?



Thanks,

Sudhanya




DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Search Discussions

  • DIGY at Jan 23, 2008 at 4:52 pm
    Hi,

    //While Indexing
    Foreach xml file
    Parse XMl File
    Document doc = new Document();
    Field f1 = new Field("empID", "10",
    Lucene.Net.Documents.Field.Store.YES,
    Lucene.Net.Documents.Field.Index.UN_TOKENIZED);
    Field f2 = new Field("empName", "Sudhanya",
    Lucene.Net.Documents.Field.Store.YES,
    Lucene.Net.Documents.Field.Index.TOKENIZED);
    Field f3 = new Field("empDept", "Development",
    Lucene.Net.Documents.Field.Store.YES,
    Lucene.Net.Documents.Field.Index.UN_TOKENIZED);
    doc.Add(f1);
    doc.Add(f2);
    doc.Add(f3);
    indexWriter.AddDocument(doc);
    EndForEach


    //While Searching
    Lucene.Net.QueryParsers.QueryParser qp = new
    Lucene.Net.QueryParsers.QueryParser("empDept", new
    Lucene.Net.Analysis.Standard.StandardAnalyzer());
    Lucene.Net.Search.Query q = qp.Parse("Development");
    Lucene.Net.Search.Hits hits = s.Search(q);

    DIGY


    -----Original Message-----
    From: Sudhanya Chatterjee
    Sent: Wednesday, January 23, 2008 4:05 PM
    To: lucene-net-user@incubator.apache.org
    Subject: lucene.net query

    Hi,



    Using lucene.net we need to perform filtered search on xml files.

    Filter should be on xml tags.



    Example -



    If the XML files contains following kind of data -



    <?xml version="1.0"?>

    <empID>10</empID>

    <empName>Sudhanya</empName>

    <empDept>Development</empDept>





    For such a collection of XML files if I want to perform a search like-

    Find all employes where empDept = "Development"



    How can I achieve this?



    Thanks,

    Sudhanya




    DISCLAIMER
    ==========
    This e-mail may contain privileged and confidential information which is the
    property of Persistent Systems Ltd. It is intended only for the use of the
    individual or entity to which it is addressed. If you are not the intended
    recipient, you are not authorized to read, retain, copy, print, distribute
    or use this message. If you have received this communication in error,
    please notify the sender and delete all copies of this message. Persistent
    Systems Ltd. does not accept any liability for virus infected mails.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouplucene-net-user @
categorieslucene
postedJan 23, '08 at 2:05p
activeJan 23, '08 at 4:52p
posts2
users2
websitelucene.apache.org

2 users in discussion

DIGY: 1 post Sudhanya Chatterjee: 1 post

People

Translate

site design / logo © 2022 Grokbase