lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: svn commit: r829995 - in /lucene/java/trunk/contrib/highlighter/src/test: ./ org/apache/lucene/search/highlight/HighlighterTest.java
Date Mon, 26 Oct 2009 22:24:04 GMT
Yup - good point. Solr 1.4 vote just started though - doubt anyone is
willing to start over for that - if something comes up, it should prob
just be removed though.

Uwe Schindler wrote:
> By the way, as Solr updated to the latest 2.9.1 artifacts: the
> SolrQueryWrapper fix for highlighter is now obsolete again?
>
> Uwe
>
>   
>> -----Original Message-----
>> From: Uwe Schindler [mailto:uwe@thetaphi.de]
>> Sent: Monday, October 26, 2009 11:19 PM
>> To: java-dev@lucene.apache.org
>> Subject: RE: svn commit: r829995 - in
>> /lucene/java/trunk/contrib/highlighter/src/test: ./
>> org/apache/lucene/search/highlight/HighlighterTest.java
>>
>> Done. I thought I added it to the fixing issue's changes entry.
>>
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe@thetaphi.de
>>
>>     
>>> -----Original Message-----
>>> From: Mark Miller [mailto:markrmiller@gmail.com]
>>> Sent: Monday, October 26, 2009 11:11 PM
>>> To: java-dev@lucene.apache.org
>>> Subject: Re: svn commit: r829995 - in
>>> /lucene/java/trunk/contrib/highlighter/src/test: ./
>>> org/apache/lucene/search/highlight/HighlighterTest.java
>>>
>>> We need a changes entry too right?
>>>
>>> uschindler@apache.org wrote:
>>>       
>>>> Author: uschindler
>>>> Date: Mon Oct 26 22:06:40 2009
>>>> New Revision: 829995
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=829995&view=rev
>>>> Log:
>>>> LUCENE-1929: Merge NumericRangeQuery tests for highlighter from 2.9
>>>>         
>>> branch. The bug was already fixed by a different impl in trunk, but the
>>> test was missing.
>>>       
>>>> Modified:
>>>>     lucene/java/trunk/contrib/highlighter/src/test/   (props changed)
>>>>
>>>>         
>> lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/hi
>>     
>>> ghlight/HighlighterTest.java
>>>       
>>>> Propchange: lucene/java/trunk/contrib/highlighter/src/test/
>>>> ----------------------------------------------------------------------
>>>>         
>> --
>>     
>>> ------
>>>       
>>>> --- svn:mergeinfo (added)
>>>> +++ svn:mergeinfo Mon Oct 26 22:06:40 2009
>>>> @@ -0,0 +1,3 @@
>>>> +/lucene/java/branches/lucene_2_4/contrib/highlighter/src/test:748824
>>>> +/lucene/java/branches/lucene_2_9/contrib/highlighter/src/test:817269-
>>>>         
>>> 818600,825998,826775,829134,829816,829881
>>>       
>> +/lucene/java/branches/lucene_2_9_back_compat_tests/contrib/highlighter/sr
>>     
>>> c/test:818601-821336
>>>       
>>>> Modified:
>>>>         
>> lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/hi
>>     
>>> ghlight/HighlighterTest.java
>>>       
>>>> URL:
>>>>         
>> http://svn.apache.org/viewvc/lucene/java/trunk/contrib/highlighter/src/tes
>>     
>> t/org/apache/lucene/search/highlight/HighlighterTest.java?rev=829995&r1=82
>>     
>>> 9994&r2=829995&view=diff
>>>       
>> ==========================================================================
>>     
>>> ====
>>>       
>>>> ---
>>>>         
>> lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/hi
>>     
>>> ghlight/HighlighterTest.java (original)
>>>       
>>>> +++
>>>>         
>> lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/hi
>>     
>>> ghlight/HighlighterTest.java Mon Oct 26 22:06:40 2009
>>>       
>>>> @@ -46,6 +46,7 @@
>>>>  import org.apache.lucene.analysis.tokenattributes.TermAttribute;
>>>>  import org.apache.lucene.document.Document;
>>>>  import org.apache.lucene.document.Field;
>>>> +import org.apache.lucene.document.NumericField;
>>>>  import org.apache.lucene.document.Field.Index;
>>>>  import org.apache.lucene.document.Field.Store;
>>>>  import org.apache.lucene.index.IndexReader;
>>>> @@ -60,6 +61,7 @@
>>>>  import org.apache.lucene.search.MultiPhraseQuery;
>>>>  import org.apache.lucene.search.MultiSearcher;
>>>>  import org.apache.lucene.search.MultiTermQuery;
>>>> +import org.apache.lucene.search.NumericRangeQuery;
>>>>  import org.apache.lucene.search.PhraseQuery;
>>>>  import org.apache.lucene.search.Query;
>>>>  import org.apache.lucene.search.TermQuery;
>>>> @@ -88,6 +90,7 @@
>>>>
>>>>    private IndexReader reader;
>>>>    static final String FIELD_NAME = "contents";
>>>> +  private static final String NUMERIC_FIELD_NAME = "nfield";
>>>>    private Query query;
>>>>    RAMDirectory ramDir;
>>>>    public IndexSearcher searcher = null;
>>>> @@ -302,6 +305,30 @@
>>>>          numHighlights == 4);
>>>>
>>>>    }
>>>> +
>>>> +  public void testNumericRangeQuery() throws Exception {
>>>> +    // doesn't currently highlight, but make sure it doesn't cause
>>>>         
>>> exception either
>>>       
>>>> +    query = NumericRangeQuery.newIntRange(NUMERIC_FIELD_NAME, 2, 6,
>>>>         
>>> true, true);
>>>       
>>>> +    searcher = new IndexSearcher(ramDir, true);
>>>> +    hits = searcher.search(query, 100);
>>>> +    int maxNumFragmentsRequired = 2;
>>>> +
>>>> +    QueryScorer scorer = new QueryScorer(query, FIELD_NAME);
>>>> +    Highlighter highlighter = new Highlighter(this, scorer);
>>>> +
>>>> +    for (int i = 0; i < hits.totalHits; i++) {
>>>> +      String text =
>>>>         
>>> searcher.doc(hits.scoreDocs[i].doc).get(NUMERIC_FIELD_NAME);
>>>       
>>>> +      TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new
>>>>         
>>> StringReader(text));
>>>       
>>>> +
>>>> +      highlighter.setTextFragmenter(new SimpleFragmenter(40));
>>>> +
>>>> +      String result = highlighter.getBestFragments(tokenStream, text,
>>>>         
>>> maxNumFragmentsRequired,
>>>       
>>>> +          "...");
>>>> +      //System.out.println("\t" + result);
>>>> +    }
>>>> +
>>>> +
>>>> +  }
>>>>
>>>>    public void testSimpleQueryScorerPhraseHighlighting2() throws
>>>>         
>>> Exception {
>>>       
>>>>      doSearching("\"text piece long\"~5");
>>>> @@ -1617,7 +1644,26 @@
>>>>      for (int i = 0; i < texts.length; i++) {
>>>>        addDoc(writer, texts[i]);
>>>>      }
>>>> -
>>>> +    Document doc = new Document();
>>>> +    NumericField nfield = new NumericField(NUMERIC_FIELD_NAME,
>>>>         
>>> Store.YES, true);
>>>       
>>>> +    nfield.setIntValue(1);
>>>> +    doc.add(nfield);
>>>> +    writer.addDocument(doc, analyzer);
>>>> +    nfield = new NumericField(NUMERIC_FIELD_NAME, Store.YES, true);
>>>> +    nfield.setIntValue(3);
>>>> +    doc = new Document();
>>>> +    doc.add(nfield);
>>>> +    writer.addDocument(doc, analyzer);
>>>> +    nfield = new NumericField(NUMERIC_FIELD_NAME, Store.YES, true);
>>>> +    nfield.setIntValue(5);
>>>> +    doc = new Document();
>>>> +    doc.add(nfield);
>>>> +    writer.addDocument(doc, analyzer);
>>>> +    nfield = new NumericField(NUMERIC_FIELD_NAME, Store.YES, true);
>>>> +    nfield.setIntValue(7);
>>>> +    doc = new Document();
>>>> +    doc.add(nfield);
>>>> +    writer.addDocument(doc, analyzer);
>>>>      writer.optimize();
>>>>      writer.close();
>>>>      reader = IndexReader.open(ramDir, true);
>>>>
>>>>
>>>>
>>>>         
>>> --
>>> - Mark
>>>
>>> http://www.lucidimagination.com
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>>       
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>     
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>   


-- 
- Mark

http://www.lucidimagination.com




---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message