lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: New to Lucene - some questions about demo
Date Tue, 28 Jul 2009 14:30:21 GMT
Jim


Glancing at SearchFiles.java I can see

Analyzer analyzer = new StandardAnalyzer();
...
QueryParser parser = new QueryParser(field, analyzer);
...
Query query = parser.parse(line);

so any query term you enter will be run through StandardAnalyzer which
will, amongst other things, convert it to lowercase and will not match
the indexed value of FooFoo.  If you're just playing, it would
probably be easiest to tell lucene to analyze the summary field e.g.

doc.add(new Field("summary", "FooFoo", Field.Store.YES, Field.Index.ANALYZED));

That will cause FooFoo to be indexed as foofoo and thus should be
matched on search.


--
Ian.


On Tue, Jul 28, 2009 at 2:22 PM, <ohaya@cox.net> wrote:
> Ian and Matthew,
>
> I've tried "foofoo", "summary:foofoo", "FooFoo", and "summary:FooFoo".  No results returned
for any of those :(.
>
> Also, Matthew, I bounced Tomcat after running IndexFiles, so I don't think that's the
problem either :(...
>
> I looked at the SearchFiles.java code, and it looks like it's literally using whatever
query string I'm entering (ditto for luceneweb).  Is there something with the query itself
that needs to be modified to support searching on the fields other than the "contents" field
(recall, I'm pretty sure that all those other fields are in the index, via Luke)?
>
> Jim
>
>
>
> ---- Ian Lea <ian.lea@gmail.com> wrote:
>> Hi
>>
>>
>> Field.Index.NOT_ANALYZED means it will be stored as is i.e. "FooFoo"
>> in your example, and if you search for "foofoo" it won't match.  A
>> search for "FooFoo" would, assuming that your search terms are not
>> being lowercased.
>>
>>
>>
>> --
>> Ian.
>>
>>
>> On Tue, Jul 28, 2009 at 1:56 PM, Ohaya<ohaya@cox.net> wrote:
>> > Hi,
>> >
>> > I'm just starting to work with Lucene, and I guess that I learn best by
>> > working with code, so I've started with the demos in the Lucene
>> > distribution.
>> >
>> > I got the IndexFiles.java and IndexHTML.java working, and also the
>> > luceneweb.war is deployed to Tomcat.
>> >
>> > I used IndexFiles.java to index some text files, and then used both the
>> > SearchFiles.java and the luceneweb web app to do some testing.
>> >
>> > One of the things that I noticed with the luceneweb web app is that when I
>> > searched, the search results returned "Summary" of "null", so I added:
>> >
>> > doc.add(new Field("summary", "FooFoo", Field.Store.YES,
>> > Field.Index.NOT_ANALYZED));
>> >
>> > to the IndexFiles.java, and ran it again.
>> >
>> > I had expected that I'd then be able to do a search for something like
>> > "summary:foofoo", but when I did that, I got no results.
>> >
>> > I also tried SearchFiles.java, and again got no results.
>> >
>> > I tried using Luke, and that is showing that the "summary" field is in the
>> > indexes, so I'm wondering why I am not able to search on other fields such
>> > as "summary", "path", etc.?
>> >
>> > Can anyone explain what else I need to do, esp. in the luceneweb web app, to
>> > be able to search these other fields?
>> >
>> > Thanks!
>> >
>> > Jim
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> > For additional commands, e-mail: java-user-help@lucene.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
>

---------------------------------------------------------------------
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