FAQ
Hi all,

I'm new to this group,

I'm using lucene for indexing. I have a problem. Any help gratly appreciate.

Please see the following code
// three fields
MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[]{"title", "tags", "content"}, new StandardAnalyzer());
// OR operator
parser.setDefaultOperator(QueryParser.Operator.OR);
// first step : search in lucene indexes
IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

// searchString is a String with many words
Query lquery = parser.parse(searchString);

//new QueryParser("content", new StandardAnalyzer());
Hits hits = searcher.search(lquery);

How can I find the matched words in searchString.
for a example
will say the searchString="wordone wordtwo wordthree". there are some hits for "wordone" and "wordthree". but no hits for "wordtwo".
So what I want is to get "wordone" and "wordthree". (results are available only for "wordone" and "wordthree". ).(I hope question is clear now)
How can i get this with lucene.

Many thanks.
Chaminda Amarasighe


---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

Search Discussions

  • Chaminda Amarasinghe at Mar 12, 2007 at 4:45 am
    Note: forwarded message attached.

    ---------------------------------
    Don't be flakey. Get Yahoo! Mail for Mobile and
    always stay connected to friends.
  • Chaminda Amarasinghe at Mar 12, 2007 at 5:01 am
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[]{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are available only for "wordone" and "wordthree". ).(I hope question is clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.
  • Chaminda Amarasinghe at Mar 12, 2007 at 7:36 am
    Why nobody is anwering me?
    Pls help me.

    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[]{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are available only for "wordone" and "wordthree". ).(I hope question is clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.
  • Karl wettin at Mar 12, 2007 at 7:41 am

    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:

    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chaminda Amarasinghe at Mar 12, 2007 at 7:43 am
    thanks karl,

    karl wettin wrote:
    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    Expecting? Get great news right away with email Auto-Check.
    Try the Yahoo! Mail Beta.
  • Vipin at Mar 12, 2007 at 9:00 am
    Hi chaminda,

    you just go through this link....

    http://today.java.net/pub/a/today/2005/08/09/didyoumean.html?page=1

    in this articles last portion(page 3) the author has suggested a way to
    handle such kind of things(Composite didyoumean parser)..

    i think it will open up a way...

    Regards,

    vipin






    On Mon, 2007-03-12 at 00:42 -0700, Chaminda Amarasinghe wrote:
    thanks karl,

    karl wettin wrote:
    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    Expecting? Get great news right away with email Auto-Check.
    Try the Yahoo! Mail Beta.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chaminda Amarasinghe at Mar 12, 2007 at 9:04 am
    Many thaks Vipin,
    I'l check

    Vipin wrote:







    Hi chaminda,

    you just go through this link....

    http://today.java.net/pub/a/today/2005/08/09/didyoumean.html?page=1

    in this articles last portion(page 3) the author has suggested a way to
    handle such kind of things(Composite didyoumean parser)..

    i think it will open up a way...

    Regards,

    vipin






    On Mon, 2007-03-12 at 00:42 -0700, Chaminda Amarasinghe wrote:
    thanks karl,

    karl wettin wrote:
    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    Expecting? Get great news right away with email Auto-Check.
    Try the Yahoo! Mail Beta.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    Be a PS3 game guru.
    Get your game face on with the latest PS3 news and previews at Yahoo! Games.
  • Mark harwood at Mar 12, 2007 at 9:16 am
    Why nobody is anwering me?
    Apologies for your 2 hour delay earlier this morning. The Lucene 24 hour helpdesk was temporarily closed while we had a weekend/life/sleep.
    If you file an official complaint you will be entitled to an immediate and full refund of your support fee.


    As for your problem - I suspect you want to look at the Highlighter package in the "contrib" section of the lucene distribution.
    The Junit test rig gives some example uses.






    ----- Original Message ----
    From: karl wettin <karl.wettin@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Monday, 12 March, 2007 7:40:34 AM
    Subject: Re: Lucene Indexing - Getting Hited words in a query


    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org









    ___________________________________________________________
    New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
    http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chaminda Amarasinghe at Mar 12, 2007 at 9:39 am
    Thanks mark harwood ,

    I want something like Highlighter thing

    where can i find such examples

    Regards Chaminda


    mark harwood wrote:
    Why nobody is anwering me?
    Apologies for your 2 hour delay earlier this morning. The Lucene 24 hour helpdesk was temporarily closed while we had a weekend/life/sleep.
    If you file an official complaint you will be entitled to an immediate and full refund of your support fee.


    As for your problem - I suspect you want to look at the Highlighter package in the "contrib" section of the lucene distribution.
    The Junit test rig gives some example uses.






    ----- Original Message ----
    From: karl wettin
    To: java-user@lucene.apache.org
    Sent: Monday, 12 March, 2007 7:40:34 AM
    Subject: Re: Lucene Indexing - Getting Hited words in a query


    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org









    ___________________________________________________________
    New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
    http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    No need to miss a message. Get email on-the-go
    with Yahoo! Mail for Mobile. Get started.
  • Mark harwood at Mar 12, 2007 at 9:56 am
    where can i find such examples
    In the source distribution here: http://apache.rmplc.co.uk/lucene/java/lucene-2.1.0-src.zip
    See the "HighlighterTest.java" file

    Alternatively, read the Javadocs example for the Highlighter package here http://lucene.apache.org/java/docs/api/



    ----- Original Message ----
    From: Chaminda Amarasinghe <amcainforsys@yahoo.com>
    To: java-user@lucene.apache.org
    Sent: Monday, 12 March, 2007 9:30:22 AM
    Subject: Re: Lucene Indexing - Getting Hited words in a query

    Thanks mark harwood ,

    I want something like Highlighter thing

    where can i find such examples

    Regards Chaminda


    mark harwood wrote:
    Why nobody is anwering me?
    Apologies for your 2 hour delay earlier this morning. The Lucene 24 hour helpdesk was temporarily closed while we had a weekend/life/sleep.
    If you file an official complaint you will be entitled to an immediate and full refund of your support fee.


    As for your problem - I suspect you want to look at the Highlighter package in the "contrib" section of the lucene distribution.
    The Junit test rig gives some example uses.






    ----- Original Message ----
    From: karl wettin
    To: java-user@lucene.apache.org
    Sent: Monday, 12 March, 2007 7:40:34 AM
    Subject: Re: Lucene Indexing - Getting Hited words in a query


    12 mar 2007 kl. 08.35 skrev Chaminda Amarasinghe:
    Why nobody is anwering me?
    Pls help me.
    It might take some time until someone that knows the answer reads you
    question.
    Chaminda Amarasinghe wrote:
    Hi all,

    I'm new to this group,

    I'm using lucene for indexing. I have a problem. Any help gratly
    appreciate.

    Please see the following code
    // three fields
    MultiFieldQueryParser parser = new MultiFieldQueryParser(new String
    []{"title", "tags", "content"}, new StandardAnalyzer());
    // OR operator
    parser.setDefaultOperator(QueryParser.Operator.OR);
    // first step : search in lucene indexes
    IndexSearcher searcher = new IndexSearcher(eventsBothDirectory)

    // searchString is a String with many words
    Query lquery = parser.parse(searchString);

    //new QueryParser("content", new StandardAnalyzer());
    Hits hits = searcher.search(lquery);

    How can I find the matched words in searchString.
    for a example
    will say the searchString="wordone wordtwo wordthree". there are
    some hits for "wordone" and "wordthree". but no hits for "wordtwo".
    So what I want is to get "wordone" and "wordthree". (results are
    available only for "wordone" and "wordthree". ).(I hope question is
    clear now)
    How can i get this with lucene.

    Many thanks.
    Chaminda Amarasighe


    ---------------------------------
    Food fight? Enjoy some healthy debate
    in the Yahoo! Answers Food & Drink Q&A.


    ---------------------------------
    Now that's room service! Choose from over 150,000 hotels
    in 45,000 destinations on Yahoo! Travel to find your fit.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org









    ___________________________________________________________
    New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
    http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------
    No need to miss a message. Get email on-the-go
    with Yahoo! Mail for Mobile. Get started.







    ___________________________________________________________
    New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
    http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 10, '07 at 11:49a
activeMar 12, '07 at 9:56a
posts11
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase