lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <apachemav...@gmail.com>
Subject Re: field cross search in lucene
Date Tue, 30 Nov 2010 13:14:02 GMT
Hi:
Sorry for later reply,I was just doing some tests.

Using the QueryParser.setDefaultOperator(..) do work ,but I found it just
for English character searching:

I have make a test,and compare three manner:
1)MultiFieldQueryParser.parse.....
2)Set the Operator of MultiFieldQueryParser..
3)Using another QueryParser:IKQueryParser (You can find it here :
http://code.google.com/p/ik-analyzer/)
The English searching:

http://dpaste.org/IEwy/ <http://dpaste.org/joOA/>

It worked as I wanted.

Then I tried to search Chinese character,I found it does not work.
http://dpaste.org/aUBF/

So,any better ideas for search Chinese characters?

2010/11/30 Anshum <anshumg@gmail.com>

> You could change Occur.SHOULD to Occur.MUST for both fields.
> This should work for you if what I understood is what you wanted.
>
>
> --
> Anshum Gupta
> http://ai-cafe.blogspot.com
>
>
> On Tue, Nov 30, 2010 at 5:12 PM, maven apache <apachemaven0@gmail.com
> >wrote:
>
> > Hi: I have two documents:
> >
> > title                       body
> > Lucene In Action            A high-performance, full-featured text search
> > engine library.
> > Lucene Practice             Use lucene in your application
> >
> > Now,I search "lucene performance" using
> >
> > private String[] f = { "title", "body"};
> > private Occur[] should = { Occur.SHOULD, Occur.SHOULD};
> > Query q = MultiFieldQueryParser.parse(Version.LUCENE_29, "lucene
> > performance", f, should,new IKAnalyzer());
> >
> > Then I get two hits: "Lucene In Action" and "Lucene Practice".
> >
> > However I do not want the "Lucene practice" in the search result.
> >
> > That's to say,I just want the documents who own all my search terms can
> be
> > returned,the "lucene parctice" does not contain the term "performance",so
> > it
> > should not be returned.
> >
> > Any ideas?
> >
> > BTW,I do really cautioned when asking a new question in the list,but I
> > really have no idea after read the documents and googling,hoping not
> > disturb
> > you guys.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message