Thanks Uwe, its works with:

            QueryParser parser = new QueryParser(Version.LUCENE_30,
"content:computer", analyzer);
            Query query = parser.parse("content:computer");

But, if i need get results like google in a query like "What is the
role of PrnP in mad cow disease?"

Thanks
CElso.

2010/11/5 Uwe Schindler <u...@thetaphi.de>:
> The default field of query parser is wrong:
> QueryParser parser = new QueryParser(Version.LUCENE_30, "computer",
> analyzer);
>
> You haven't indexed a field with name "computer". Your query string does not
> override the field, so your query is in fact "computer:computer".
>
> A note: It is not recommended to instantiate TopScoreDocCollector directly
> for such search cases, just use the IndexSearcher method that returns
> TopDocs!
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: u...@thetaphi.de
>
>> -----Original Message-----
>> From: Celso Fontes [mailto:cels...@gmail.com]
>> Sent: Friday, November 05, 2010 3:34 AM
>> To: java-user@lucene.apache.org
>> Subject: How index and search text files in Lucene 3.0.2 ?
>>
>> Hi ! I am newbie in lucene, and i have some problems to create a simple
> code
>> to query a text file collection.
>>
>> My code is this (http://pastebin.com/HqrbBPtp), but does not works.
>> What is Wrong?
>>
>> Thanks,
>> Celso.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

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

Reply via email to