lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Meeraj Kunnumpurath <meeraj.kunnumpur...@asyska.com>
Subject Re: Optional Terms
Date Thu, 17 May 2012 11:03:58 GMT
Thanks Ian

Sent from my iPhone

On 17 May 2012, at 09:29, Ian Lea <ian.lea@gmail.com> wrote:

>> Document doc3 = new Document();
>> doc2.add(new Field("searchText", "LMN Takeaway", Field.Store.YES,
> 
> doc2 != doc3.
> 
> Boosting by number of occurrences tends to happen automatically.  See
> IndexSearcher.explain() as I think someone already suggested.  See
> also javadocs for org.apache.lucene.search.Similarity.  You can plug
> in your own implementation if you want to tweak the scoring.
> 
> 
> --
> Ian.
> 
> 
> On Wed, May 16, 2012 at 10:06 PM, Meeraj Kunnumpurath
> <meeraj.kunnumpurath@asyska.com> wrote:
>> Hi,
>> 
>> I have the following documents
>> 
>> Document doc1 = new Document();
>> doc1.add(new Field("searchText", "ABC Takeaway fred@company.com
>> fred@company.com", Field.Store.YES, Field.Index.ANALYZED));
>> Document doc2 = new Document();
>> doc2.add(new Field("searchText", "XYZ Takeaway fred@company.com",
>> Field.Store.YES, Field.Index.ANALYZED));
>> Document doc3 = new Document();
>> doc2.add(new Field("searchText", "LMN Takeaway", Field.Store.YES,
>> Field.Index.ANALYZED));
>> 
>> My query is
>> 
>> Query q = new QueryParser(Version.LUCENE_35, "searchText",
>> analyzer).parse("+Takeaway fred@company.com^100");
>> 
>> This returns only doc1 and doc2. How do I need to modify the query, so that
>> the first term (Takeaway) is mandatory and the second one (fred@company.com)
>> is optional? Also, I would like to boost those documents based on the
>> number of occurrences of the second term.
>> 
>> Regards
>> Meeraj
> 
> ---------------------------------------------------------------------
> 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