lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: Analyse TermQuery and PhraseQuery
Date Thu, 19 Feb 2009 12:07:46 GMT

On Feb 19, 2009, at 5:54 AM, Nada Mimouni wrote:

>
>
> Hello,
>
> String ws = " ";
> String query = "The"+ws+"president"+ws+"of"+ws+"the"+ws+"USA"+ws 
> +"is"+ws+""\Barak Obama\"";
> Query q = QueryParser.parse(query, new StandardAnalyser());
> Query q = QueryParser.parse(query, new WhitespaceAnalyser());
>
>
> In this example:
> - could we create a query in such a format (combine terms and  
> phrases)?

Sure, why not try it?  Is it not working?

>
> - what will be the result of the analysis?

Instead of telling you the answer, I'm going to suggest you add:

System.out.println("Query: " + q);

after each of the parses and take a look at what gets printed.  That  
should tell you what you need to know.


>
> - what should I do to get this hits {president, USA, Barak Obama}?
>

You should have documents that contain the two words, plus the phrase.

I guess the question back is, do you know you have those documents and  
are not getting results?

Or, are you asking how to submit and run the query?  If that is the  
case, have a look at http://www.lucidimagination.com/Community/Hear-from-the-Experts/Articles/Getting-Started-with-Lucene/


Cheers,
Grant

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)  
using Solr/Lucene:
http://www.lucidimagination.com/search


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


Mime
View raw message