On Fri, Dec 05, 2003 at 02:45:34PM -0500, Pleasant, Tracy wrote: > Maybe we are having some communication issues. > > At any rate, I did index it as a KEYWORD and when displaying used the > TermQuery. > > The only problem with this though is by storing the ID (i.e. AR345) as a > Keyword, if I search for AR345 no results are returned when I use the > MultiFieldQueryParser . > > *sigh* *arg*
OK. Go to http://www.fastbuzz.com/search/index.jsp and type "lucene" without the quotes and hit search. You get results from different channels/rss feeds. Now type "lucene channel:11183" without the quotes and hit search. You get results only from Java-Channel. We're inserting the field channel as a keyword, and it does what I understand you want to use AR345. I would guess that in MultiFieldQueryParser you are not doing an add() of the field for AR345 which is why the search fails. Regards, Dror > > > > -----Original Message----- > From: Erik Hatcher [mailto:[EMAIL PROTECTED] > Sent: Friday, December 05, 2003 2:13 PM > To: Lucene Users List > Subject: Re: Returning one result > > > On Friday, December 5, 2003, at 01:25 PM, Pleasant, Tracy wrote: > > Say ID is Ar3453 .. well the user may want to search for Ar3453, so in > > order for it to be searchable then it would have to be indexed and not > > > a > > keyword. > > *arg* - we're having a serious communication issue here. My advice to > you is to actually write some simple tests (test-driven learning using > JUnit is a wonderful way to experiement with Lucene, especially thanks > to the RAMDirectory). Please refer to my articles at java.net as well > as the other great Lucene articles out there. > > Let me try again.... a Field.Keyword *IS* indexed! Even Lucene's > javadocs say this for this method: > > /** Constructs a String-valued Field that is not tokenized, but is > >>>indexed<<< > and stored. Useful for non-text fields, e.g. date or url. */ > > [I added the emphasis there] > > > > So after using > > TermQuery query = new TermQuery(new Term("id", term)); > > > > How would I return the other fields in the document? > > > > For instance to display a record it would get the record with the id # > > and then display the title, contents, etc. > > Umm.... you'd use *exactly* the same way as if you had used > QueryParser. QueryParser would create a TermQuery for you, in fact, > except it would analyze your text first, which is what you want to > avoid, right? > > Hits.doc(n) gives you back a Document. And then > Document.get("fieldName") gives you back the fields (as long as you >>> > stored <<< them in the index too). > > Again, please attempt some of these things in code. It is a trivial > matter to index and search using RAMDirectory and experiment with > TermQuery, QueryParser, Analyzers, etc. > > Erik > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Dror Matalon Zapatec Inc 1700 MLK Way Berkeley, CA 94709 http://www.fastbuzz.com http://www.zapatec.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]