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 Dmitrii PapaGeorgio <te...@woh.rr.com> on 2004/08/15 22:13:43 UTC
Index and Search question in Lucene.
Ok so when I index a file such as below
Document doc = new Document();
doc.Add(Field.Text("contents", new StreamReader(dataDir)));
doc.Add(Field.Keyword("filename", dataDir));
I can do a search as this
"+contents:SomeWord +filename:SomePath"
Correct?
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: Index and Search question in Lucene.
Posted by Ernesto De Santis <er...@colaborativa.net>.
Hi Dimitri
What analyzer you use?
You need take carefully with Keyword fields and analyzers. When you
index a Document, the fields that have set tokenized = false, like
Keyword, are not analyzed.
In search time you need parse the query with your analyzer but not
analyze the untokenized fields, like your filename.
> I can do a search as this
> "+contents:SomeWord +filename:SomePath"
>
The sintaxis is rigth, but if you search +filename:somepath, find only
this file.
For example,
+content:version +filename:/my/path/myfile.ext
Only can found myfile.ext, and if this file don't content "version", not
going to find nothing. This is because you use +. + set the term
required.
You can see the queries sintaxis in lucene site.
http://jakarta.apache.org/lucene/docs/queryparsersyntax.html
http://lucene.sourceforge.net/cgi-bin/faq/faqmanager.cgi?file=chapter.search&toc=faq#q5
good luck.
Bye
Ernesto.
El dom, 15 de 08 de 2004 a las 17:13, Dmitrii PapaGeorgio escribió:
> Ok so when I index a file such as below
>
> Document doc = new Document();
> doc.Add(Field.Text("contents", new StreamReader(dataDir)));
> doc.Add(Field.Keyword("filename", dataDir));
>
> I can do a search as this
> "+contents:SomeWord +filename:SomePath"
>
> Correct?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org