You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Chaminda Amarasinghe <am...@yahoo.com> on 2007/03/12 06:01:22 UTC
Lucene Indexing - Getting Hited words in a query
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.
Re: Lucene Indexing - Getting Hited words in a query
Posted by Chaminda Amarasinghe <am...@yahoo.com>.
Many thaks Vipin,
I'l check
Vipin <vi...@qburst.com> 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.
Re: Lucene Indexing - Getting Hited words in a query
Posted by Vipin <vi...@qburst.com>.
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 <ka...@gmail.com> 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
Re: Lucene Indexing - Getting Hited words in a query
Posted by Chaminda Amarasinghe <am...@yahoo.com>.
thanks karl,
karl wettin <ka...@gmail.com> 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.
Re: Lucene Indexing - Getting Hited words in a query
Posted by karl wettin <ka...@gmail.com>.
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 <am...@yahoo.com> 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
Re: Lucene Indexing - Getting Hited words in a query
Posted by Chaminda Amarasinghe <am...@yahoo.com>.
Why nobody is anwering me?
Pls help me.
Chaminda Amarasinghe <am...@yahoo.com> 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.