You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bruno <br...@gmail.com> on 2009/06/18 19:22:12 UTC

SolrJ: Highlighting not Working

Hi guys.

I new at using highlighting, so probably I'm making some stupid mistake,
however I'm not founding anything wrong.

I use highlighting from a query withing a EmbeddedSolrServer, and within the
query I've set parameters necessary for enabling highlighting. Attached,
follows my schema and solrconfig.xml , and down below follows the Java code.
Content from the SolrDocumentList is not highlighted.


EmbeddedSolrServer server = SolrServerManager.*getServerEv*();
String queryString = filter;
SolrQuery query = *new* SolrQuery();

query.setQuery(queryString);
query.setHighlight(*true*);
query.addHighlightField(*LOG_FIELD*);
query.setHighlightSimplePost("<i>");
query.setHighlightSimplePre("</i>");
query.set("hl.usePhraseHighlighter", *true*);
query.set("hl.highlightMultiTerm", *true*);
query.set("hl.snippets", 100);
query.set("hl.fragsize", 1);
query.set("hl.mergeContiguous", *false*);
query.set("hl.requireFieldMatch", *false*);
query.set("hl.maxAnalyzedChars", -1);

query.addSortField(*DATE_FIELD*, SolrQuery.ORDER.*asc*);
query.setFacetLimit(LogUtilProperties.*getInstance*
().getProperty(LogUtilProperties.*LOGEVENT_SEARCH_RESULT_SIZE*, 10000));
query.setRows(LogUtilProperties.*getInstance*
().getProperty(LogUtilProperties.*LOGEVENT_SEARCH_RESULT_SIZE*, 10000));
query.setIncludeScore(*true*);
 QueryResponse rsp = server.query(query);
SolrDocumentList docs = rsp.getResults();

-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
And unfortunately, that isn't the best approach for highlighting to  
take - a uniqueKey shouldn't be required for highlighting.  I've yet  
to see a real-world deployment of Solr that did not have a uniqueKey  
field, but there's no reason Solr should make that assumption.

	Erik

On Jun 18, 2009, at 3:24 PM, Bruno wrote:

> Just figured out what happened... It's necessary for the schema to  
> have a
> uniqueKey set, otherwise, highlighting will have one or less  
> entries, as the
> map's key is the doc uniqueKey, so on debuggin I figured out that the
> QueryResponse tries to put all highlighted results in a map with  
> null key...
> at end, putting tons of entries all with null key will result on a
> one-entry-only map.
>
> Thanks for the help guys.
>
> On Thu, Jun 18, 2009 at 3:17 PM, Bruno <br...@gmail.com> wrote:
>
>> I've checked the NamedList you told me about, but it contains only  
>> one
>> highlighted doc, when there I have more docs that sould be  
>> highlighted.
>>
>>
>> On Thu, Jun 18, 2009 at 3:03 PM, Erik Hatcher <erik@ehatchersolutions.com 
>> >wrote:
>>
>>> Note that highlighting is NOT part of the document list returned.   
>>> It's in
>>> an additional NamedList section of the response (with  
>>> name="highlighting")
>>>
>>>       Erik
>>>
>>>
>>> On Jun 18, 2009, at 1:22 PM, Bruno wrote:
>>>
>>> Hi guys.
>>>>
>>>> I new at using highlighting, so probably I'm making some stupid  
>>>> mistake,
>>>> however I'm not founding anything wrong.
>>>>
>>>> I use highlighting from a query withing a EmbeddedSolrServer, and  
>>>> within
>>>> the query I've set parameters necessary for enabling  
>>>> highlighting. Attached,
>>>> follows my schema and solrconfig.xml , and down below follows the  
>>>> Java code.
>>>> Content from the SolrDocumentList is not highlighted.
>>>>
>>>> EmbeddedSolrServer server = SolrServerManager.getServerEv();
>>>> String queryString = filter;
>>>> SolrQuery query =
>>>>
>>>> new SolrQuery();
>>>>
>>>> query.setQuery(queryString);
>>>> query.setHighlight(true);
>>>> query.addHighlightField(LOG_FIELD);
>>>> query.setHighlightSimplePost("<i>");
>>>> query.setHighlightSimplePre("</i>");
>>>> query.set("hl.usePhraseHighlighter", true);
>>>> query.set("hl.highlightMultiTerm", true);
>>>> query.set("hl.snippets", 100);
>>>> query.set("hl.fragsize", 1);
>>>> query.set("hl.mergeContiguous", false);
>>>> query.set("hl.requireFieldMatch", false);
>>>> query.set("hl.maxAnalyzedChars", -1);
>>>>
>>>> query.addSortField(DATE_FIELD, SolrQuery.ORDER.asc);
>>>> query 
>>>> .setFacetLimit 
>>>> (LogUtilProperties 
>>>> .getInstance 
>>>> ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>>>> 10000));
>>>> query 
>>>> .setRows 
>>>> (LogUtilProperties 
>>>> .getInstance 
>>>> ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>>>> 10000));
>>>> query.setIncludeScore(true);
>>>> QueryResponse rsp = server.query(query);
>>>> SolrDocumentList docs = rsp.getResults();
>>>>
>>>> --
>>>> Bruno Morelli Vargas
>>>> Mail: brunomv@gmail.com
>>>> Msn: brunom_@hotmail.com
>>>> Icq: 165055101
>>>> Skype: morellibmv
>>>>
>>>> <schema.xml><solrconfig.xml>
>>>>
>>>
>>>
>>
>>
>> --
>> Bruno Morelli Vargas
>> Mail: brunomv@gmail.com
>> Msn: brunom_@hotmail.com
>> Icq: 165055101
>> Skype: morellibmv
>>
>>
>
>
> -- 
> Bruno Morelli Vargas
> Mail: brunomv@gmail.com
> Msn: brunom_@hotmail.com
> Icq: 165055101
> Skype: morellibmv


Re: SolrJ: Highlighting not Working

Posted by Bruno <br...@gmail.com>.
Just figured out what happened... It's necessary for the schema to have a
uniqueKey set, otherwise, highlighting will have one or less entries, as the
map's key is the doc uniqueKey, so on debuggin I figured out that the
QueryResponse tries to put all highlighted results in a map with null key...
at end, putting tons of entries all with null key will result on a
one-entry-only map.

Thanks for the help guys.

On Thu, Jun 18, 2009 at 3:17 PM, Bruno <br...@gmail.com> wrote:

> I've checked the NamedList you told me about, but it contains only one
> highlighted doc, when there I have more docs that sould be highlighted.
>
>
> On Thu, Jun 18, 2009 at 3:03 PM, Erik Hatcher <er...@ehatchersolutions.com>wrote:
>
>> Note that highlighting is NOT part of the document list returned.  It's in
>> an additional NamedList section of the response (with name="highlighting")
>>
>>        Erik
>>
>>
>> On Jun 18, 2009, at 1:22 PM, Bruno wrote:
>>
>>  Hi guys.
>>>
>>> I new at using highlighting, so probably I'm making some stupid mistake,
>>> however I'm not founding anything wrong.
>>>
>>> I use highlighting from a query withing a EmbeddedSolrServer, and within
>>> the query I've set parameters necessary for enabling highlighting. Attached,
>>> follows my schema and solrconfig.xml , and down below follows the Java code.
>>> Content from the SolrDocumentList is not highlighted.
>>>
>>> EmbeddedSolrServer server = SolrServerManager.getServerEv();
>>> String queryString = filter;
>>> SolrQuery query =
>>>
>>> new SolrQuery();
>>>
>>> query.setQuery(queryString);
>>> query.setHighlight(true);
>>> query.addHighlightField(LOG_FIELD);
>>> query.setHighlightSimplePost("<i>");
>>> query.setHighlightSimplePre("</i>");
>>> query.set("hl.usePhraseHighlighter", true);
>>> query.set("hl.highlightMultiTerm", true);
>>> query.set("hl.snippets", 100);
>>> query.set("hl.fragsize", 1);
>>> query.set("hl.mergeContiguous", false);
>>> query.set("hl.requireFieldMatch", false);
>>> query.set("hl.maxAnalyzedChars", -1);
>>>
>>> query.addSortField(DATE_FIELD, SolrQuery.ORDER.asc);
>>> query.setFacetLimit(LogUtilProperties.getInstance().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>>> 10000));
>>> query.setRows(LogUtilProperties.getInstance().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>>> 10000));
>>> query.setIncludeScore(true);
>>> QueryResponse rsp = server.query(query);
>>> SolrDocumentList docs = rsp.getResults();
>>>
>>> --
>>> Bruno Morelli Vargas
>>> Mail: brunomv@gmail.com
>>> Msn: brunom_@hotmail.com
>>> Icq: 165055101
>>> Skype: morellibmv
>>>
>>> <schema.xml><solrconfig.xml>
>>>
>>
>>
>
>
> --
> Bruno Morelli Vargas
> Mail: brunomv@gmail.com
> Msn: brunom_@hotmail.com
> Icq: 165055101
> Skype: morellibmv
>
>


-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Bruno <br...@gmail.com>.
I've checked the NamedList you told me about, but it contains only one
highlighted doc, when there I have more docs that sould be highlighted.

On Thu, Jun 18, 2009 at 3:03 PM, Erik Hatcher <er...@ehatchersolutions.com>wrote:

> Note that highlighting is NOT part of the document list returned.  It's in
> an additional NamedList section of the response (with name="highlighting")
>
>        Erik
>
>
> On Jun 18, 2009, at 1:22 PM, Bruno wrote:
>
>  Hi guys.
>>
>> I new at using highlighting, so probably I'm making some stupid mistake,
>> however I'm not founding anything wrong.
>>
>> I use highlighting from a query withing a EmbeddedSolrServer, and within
>> the query I've set parameters necessary for enabling highlighting. Attached,
>> follows my schema and solrconfig.xml , and down below follows the Java code.
>> Content from the SolrDocumentList is not highlighted.
>>
>> EmbeddedSolrServer server = SolrServerManager.getServerEv();
>> String queryString = filter;
>> SolrQuery query =
>>
>> new SolrQuery();
>>
>> query.setQuery(queryString);
>> query.setHighlight(true);
>> query.addHighlightField(LOG_FIELD);
>> query.setHighlightSimplePost("<i>");
>> query.setHighlightSimplePre("</i>");
>> query.set("hl.usePhraseHighlighter", true);
>> query.set("hl.highlightMultiTerm", true);
>> query.set("hl.snippets", 100);
>> query.set("hl.fragsize", 1);
>> query.set("hl.mergeContiguous", false);
>> query.set("hl.requireFieldMatch", false);
>> query.set("hl.maxAnalyzedChars", -1);
>>
>> query.addSortField(DATE_FIELD, SolrQuery.ORDER.asc);
>> query.setFacetLimit(LogUtilProperties.getInstance().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>> 10000));
>> query.setRows(LogUtilProperties.getInstance().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE,
>> 10000));
>> query.setIncludeScore(true);
>> QueryResponse rsp = server.query(query);
>> SolrDocumentList docs = rsp.getResults();
>>
>> --
>> Bruno Morelli Vargas
>> Mail: brunomv@gmail.com
>> Msn: brunom_@hotmail.com
>> Icq: 165055101
>> Skype: morellibmv
>>
>> <schema.xml><solrconfig.xml>
>>
>
>


-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Note that highlighting is NOT part of the document list returned.   
It's in an additional NamedList section of the response (with  
name="highlighting")

	Erik

On Jun 18, 2009, at 1:22 PM, Bruno wrote:

> Hi guys.
>
> I new at using highlighting, so probably I'm making some stupid  
> mistake, however I'm not founding anything wrong.
>
> I use highlighting from a query withing a EmbeddedSolrServer, and  
> within the query I've set parameters necessary for enabling  
> highlighting. Attached, follows my schema and solrconfig.xml , and  
> down below follows the Java code. Content from the SolrDocumentList  
> is not highlighted.
>
> EmbeddedSolrServer server = SolrServerManager.getServerEv();
> String queryString = filter;
> SolrQuery query =
>
> new SolrQuery();
>
> query.setQuery(queryString);
> query.setHighlight(true);
> query.addHighlightField(LOG_FIELD);
> query.setHighlightSimplePost("<i>");
> query.setHighlightSimplePre("</i>");
> query.set("hl.usePhraseHighlighter", true);
> query.set("hl.highlightMultiTerm", true);
> query.set("hl.snippets", 100);
> query.set("hl.fragsize", 1);
> query.set("hl.mergeContiguous", false);
> query.set("hl.requireFieldMatch", false);
> query.set("hl.maxAnalyzedChars", -1);
>
> query.addSortField(DATE_FIELD, SolrQuery.ORDER.asc);
> query 
> .setFacetLimit 
> (LogUtilProperties 
> .getInstance 
> ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE, 10000));
> query 
> .setRows 
> (LogUtilProperties 
> .getInstance 
> ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE, 10000));
> query.setIncludeScore(true);
> QueryResponse rsp = server.query(query);
> SolrDocumentList docs = rsp.getResults();
>
> -- 
> Bruno Morelli Vargas
> Mail: brunomv@gmail.com
> Msn: brunom_@hotmail.com
> Icq: 165055101
> Skype: morellibmv
>
> <schema.xml><solrconfig.xml>


Re: SolrJ: Highlighting not Working

Posted by Bruno <br...@gmail.com>.
Here is the query, search for the term "ipod" on the "log" field
q=log%3Aipod+AND+requestid%3A1029+AND+logfilename%3Apayxdev-1245272062125-USS.log.zip&hl=true&hl.fl=log&hl.fl=message&hl.simple.post=%3Ci%3E&hl.simple.pre=%3C%2Fi%3E&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true&hl.snippets=100&hl.fragsize=100&hl.mergeContiguous=false&hl.requireFieldMatch=false&hl.maxAnalyzedChars=-1&sort=timestamp+asc&facet.limit=6000&rows=6000&fl=score

On Thu, Jun 18, 2009 at 2:51 PM, Mark Miller <ma...@gmail.com> wrote:

> Nothing off the top of my head ...
>
> I can play around with some of the solrj unit tests a bit later and perhaps
> see if I can dig anything up.
>
> Note:
> if you expect wildcard/prefix/etc queries to highlight, they will not with
> Solr 1.3.
>
> query.set("hl.highlightMultiTerm", *true*);
>
> The above only applies to solr 1.4.
> So if your query is just a wildcard ...
>
> What is your query, by the way?
>
>
>
> --
> - Mark
>
> http://www.lucidimagination.com
>
>
>
> Bruno wrote:
>
>> Couple of things I've forgot to mention:
>>
>> Solr Version: 1.3
>> Enviroment: Websphere
>>
>> On Thu, Jun 18, 2009 at 2:34 PM, Bruno <br...@gmail.com> wrote:
>>
>>
>>
>>> I've tried with default values and didn't work either.
>>>
>>>
>>> On Thu, Jun 18, 2009 at 2:31 PM, Mark Miller <markrmiller@gmail.com
>>> >wrote:
>>>
>>>
>>>
>>>> Why do you have:
>>>> query.set("hl.maxAnalyzedChars", -1);
>>>>
>>>> Have you tried using the default? Unless -1 is an undoc'd feature, this
>>>> means you wouldnt get anything back! This should normally be a fairly
>>>> hefty
>>>> value and defaults to 51200, according to the wiki.
>>>>
>>>> And why:
>>>> query.set("hl.fragsize", 1);
>>>>
>>>> That means a fragment could only be 1 char - again, I'd try the default
>>>> (take out the param), and adjust from there.
>>>> (wiki says the default is 100).
>>>>
>>>> Let us know how it goes.
>>>>
>>>> --
>>>> - Mark
>>>>
>>>> http://www.lucidimagination.com
>>>>
>>>>
>>>>
>>>> Bruno wrote:
>>>>
>>>>
>>>>
>>>>>  Hi guys.
>>>>>  I new at using highlighting, so probably I'm making some stupid
>>>>> mistake,
>>>>> however I'm not founding anything wrong.
>>>>>  I use highlighting from a query withing a EmbeddedSolrServer, and
>>>>> within
>>>>> the query I've set parameters necessary for enabling highlighting.
>>>>> Attached,
>>>>> follows my schema and solrconfig.xml , and down below follows the Java
>>>>> code.
>>>>> Content from the SolrDocumentList is not highlighted.
>>>>>
>>>>> EmbeddedSolrServer server = SolrServerManager./getServerEv/();
>>>>> String queryString = filter;
>>>>> SolrQuery query =
>>>>>
>>>>> *new* SolrQuery();
>>>>>
>>>>> query.setQuery(queryString);
>>>>> query.setHighlight(*true*);
>>>>> query.addHighlightField(/LOG_FIELD/);
>>>>> query.setHighlightSimplePost("<i>");
>>>>> query.setHighlightSimplePre("</i>");
>>>>> query.set("hl.usePhraseHighlighter", *true*);
>>>>> query.set("hl.highlightMultiTerm", *true*);
>>>>> query.set("hl.snippets", 100);
>>>>> query.set("hl.fragsize", 1);
>>>>> query.set("hl.mergeContiguous", *false*);
>>>>> query.set("hl.requireFieldMatch", *false*);
>>>>> query.set("hl.maxAnalyzedChars", -1);
>>>>>
>>>>> query.addSortField(/DATE_FIELD/, SolrQuery.ORDER./asc/);
>>>>>
>>>>> query.setFacetLimit(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>>>> 10000));
>>>>>
>>>>> query.setRows(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>>>> 10000));
>>>>> query.setIncludeScore(*true*);
>>>>> QueryResponse rsp = server.query(query);
>>>>> SolrDocumentList docs = rsp.getResults();
>>>>>
>>>>> --
>>>>> Bruno Morelli Vargas      Mail: brunomv@gmail.com <mailto:
>>>>> brunomv@gmail.com>
>>>>> Msn: brunom_@hotmail.com <ma...@hotmail.com>
>>>>> Icq: 165055101
>>>>> Skype: morellibmv
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> --
>>> Bruno Morelli Vargas
>>> Mail: brunomv@gmail.com
>>> Msn: brunom_@hotmail.com
>>> Icq: 165055101
>>> Skype: morellibmv
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
>


-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Mark Miller <ma...@gmail.com>.
Nothing off the top of my head ...

I can play around with some of the solrj unit tests a bit later and 
perhaps see if I can dig anything up.

Note:
if you expect wildcard/prefix/etc queries to highlight, they will not 
with Solr 1.3.

query.set("hl.highlightMultiTerm", *true*);

The above only applies to solr 1.4.
So if your query is just a wildcard ...

What is your query, by the way?


-- 
- Mark

http://www.lucidimagination.com



Bruno wrote:
> Couple of things I've forgot to mention:
>
> Solr Version: 1.3
> Enviroment: Websphere
>
> On Thu, Jun 18, 2009 at 2:34 PM, Bruno <br...@gmail.com> wrote:
>
>   
>> I've tried with default values and didn't work either.
>>
>>
>> On Thu, Jun 18, 2009 at 2:31 PM, Mark Miller <ma...@gmail.com>wrote:
>>
>>     
>>> Why do you have:
>>> query.set("hl.maxAnalyzedChars", -1);
>>>
>>> Have you tried using the default? Unless -1 is an undoc'd feature, this
>>> means you wouldnt get anything back! This should normally be a fairly hefty
>>> value and defaults to 51200, according to the wiki.
>>>
>>> And why:
>>> query.set("hl.fragsize", 1);
>>>
>>> That means a fragment could only be 1 char - again, I'd try the default
>>> (take out the param), and adjust from there.
>>> (wiki says the default is 100).
>>>
>>> Let us know how it goes.
>>>
>>> --
>>> - Mark
>>>
>>> http://www.lucidimagination.com
>>>
>>>
>>>
>>> Bruno wrote:
>>>
>>>       
>>>>  Hi guys.
>>>>  I new at using highlighting, so probably I'm making some stupid mistake,
>>>> however I'm not founding anything wrong.
>>>>  I use highlighting from a query withing a EmbeddedSolrServer, and within
>>>> the query I've set parameters necessary for enabling highlighting. Attached,
>>>> follows my schema and solrconfig.xml , and down below follows the Java code.
>>>> Content from the SolrDocumentList is not highlighted.
>>>>
>>>> EmbeddedSolrServer server = SolrServerManager./getServerEv/();
>>>> String queryString = filter;
>>>> SolrQuery query =
>>>>
>>>> *new* SolrQuery();
>>>>
>>>> query.setQuery(queryString);
>>>> query.setHighlight(*true*);
>>>> query.addHighlightField(/LOG_FIELD/);
>>>> query.setHighlightSimplePost("<i>");
>>>> query.setHighlightSimplePre("</i>");
>>>> query.set("hl.usePhraseHighlighter", *true*);
>>>> query.set("hl.highlightMultiTerm", *true*);
>>>> query.set("hl.snippets", 100);
>>>> query.set("hl.fragsize", 1);
>>>> query.set("hl.mergeContiguous", *false*);
>>>> query.set("hl.requireFieldMatch", *false*);
>>>> query.set("hl.maxAnalyzedChars", -1);
>>>>
>>>> query.addSortField(/DATE_FIELD/, SolrQuery.ORDER./asc/);
>>>> query.setFacetLimit(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>>> 10000));
>>>> query.setRows(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>>> 10000));
>>>> query.setIncludeScore(*true*);
>>>> QueryResponse rsp = server.query(query);
>>>> SolrDocumentList docs = rsp.getResults();
>>>>
>>>> --
>>>> Bruno Morelli Vargas      Mail: brunomv@gmail.com <mailto:
>>>> brunomv@gmail.com>
>>>> Msn: brunom_@hotmail.com <ma...@hotmail.com>
>>>> Icq: 165055101
>>>> Skype: morellibmv
>>>>
>>>>
>>>>         
>>>
>>>       
>> --
>> Bruno Morelli Vargas
>> Mail: brunomv@gmail.com
>> Msn: brunom_@hotmail.com
>> Icq: 165055101
>> Skype: morellibmv
>>
>>
>>     
>
>
>   




Re: SolrJ: Highlighting not Working

Posted by Bruno <br...@gmail.com>.
Couple of things I've forgot to mention:

Solr Version: 1.3
Enviroment: Websphere

On Thu, Jun 18, 2009 at 2:34 PM, Bruno <br...@gmail.com> wrote:

> I've tried with default values and didn't work either.
>
>
> On Thu, Jun 18, 2009 at 2:31 PM, Mark Miller <ma...@gmail.com>wrote:
>
>> Why do you have:
>> query.set("hl.maxAnalyzedChars", -1);
>>
>> Have you tried using the default? Unless -1 is an undoc'd feature, this
>> means you wouldnt get anything back! This should normally be a fairly hefty
>> value and defaults to 51200, according to the wiki.
>>
>> And why:
>> query.set("hl.fragsize", 1);
>>
>> That means a fragment could only be 1 char - again, I'd try the default
>> (take out the param), and adjust from there.
>> (wiki says the default is 100).
>>
>> Let us know how it goes.
>>
>> --
>> - Mark
>>
>> http://www.lucidimagination.com
>>
>>
>>
>> Bruno wrote:
>>
>>>  Hi guys.
>>>  I new at using highlighting, so probably I'm making some stupid mistake,
>>> however I'm not founding anything wrong.
>>>  I use highlighting from a query withing a EmbeddedSolrServer, and within
>>> the query I've set parameters necessary for enabling highlighting. Attached,
>>> follows my schema and solrconfig.xml , and down below follows the Java code.
>>> Content from the SolrDocumentList is not highlighted.
>>>
>>> EmbeddedSolrServer server = SolrServerManager./getServerEv/();
>>> String queryString = filter;
>>> SolrQuery query =
>>>
>>> *new* SolrQuery();
>>>
>>> query.setQuery(queryString);
>>> query.setHighlight(*true*);
>>> query.addHighlightField(/LOG_FIELD/);
>>> query.setHighlightSimplePost("<i>");
>>> query.setHighlightSimplePre("</i>");
>>> query.set("hl.usePhraseHighlighter", *true*);
>>> query.set("hl.highlightMultiTerm", *true*);
>>> query.set("hl.snippets", 100);
>>> query.set("hl.fragsize", 1);
>>> query.set("hl.mergeContiguous", *false*);
>>> query.set("hl.requireFieldMatch", *false*);
>>> query.set("hl.maxAnalyzedChars", -1);
>>>
>>> query.addSortField(/DATE_FIELD/, SolrQuery.ORDER./asc/);
>>> query.setFacetLimit(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>> 10000));
>>> query.setRows(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>>> 10000));
>>> query.setIncludeScore(*true*);
>>> QueryResponse rsp = server.query(query);
>>> SolrDocumentList docs = rsp.getResults();
>>>
>>> --
>>> Bruno Morelli Vargas      Mail: brunomv@gmail.com <mailto:
>>> brunomv@gmail.com>
>>> Msn: brunom_@hotmail.com <ma...@hotmail.com>
>>> Icq: 165055101
>>> Skype: morellibmv
>>>
>>>
>>
>>
>>
>
>
> --
> Bruno Morelli Vargas
> Mail: brunomv@gmail.com
> Msn: brunom_@hotmail.com
> Icq: 165055101
> Skype: morellibmv
>
>


-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Bruno <br...@gmail.com>.
I've tried with default values and didn't work either.


On Thu, Jun 18, 2009 at 2:31 PM, Mark Miller <ma...@gmail.com> wrote:

> Why do you have:
> query.set("hl.maxAnalyzedChars", -1);
>
> Have you tried using the default? Unless -1 is an undoc'd feature, this
> means you wouldnt get anything back! This should normally be a fairly hefty
> value and defaults to 51200, according to the wiki.
>
> And why:
> query.set("hl.fragsize", 1);
>
> That means a fragment could only be 1 char - again, I'd try the default
> (take out the param), and adjust from there.
> (wiki says the default is 100).
>
> Let us know how it goes.
>
> --
> - Mark
>
> http://www.lucidimagination.com
>
>
>
> Bruno wrote:
>
>>  Hi guys.
>>  I new at using highlighting, so probably I'm making some stupid mistake,
>> however I'm not founding anything wrong.
>>  I use highlighting from a query withing a EmbeddedSolrServer, and within
>> the query I've set parameters necessary for enabling highlighting. Attached,
>> follows my schema and solrconfig.xml , and down below follows the Java code.
>> Content from the SolrDocumentList is not highlighted.
>>
>> EmbeddedSolrServer server = SolrServerManager./getServerEv/();
>> String queryString = filter;
>> SolrQuery query =
>>
>> *new* SolrQuery();
>>
>> query.setQuery(queryString);
>> query.setHighlight(*true*);
>> query.addHighlightField(/LOG_FIELD/);
>> query.setHighlightSimplePost("<i>");
>> query.setHighlightSimplePre("</i>");
>> query.set("hl.usePhraseHighlighter", *true*);
>> query.set("hl.highlightMultiTerm", *true*);
>> query.set("hl.snippets", 100);
>> query.set("hl.fragsize", 1);
>> query.set("hl.mergeContiguous", *false*);
>> query.set("hl.requireFieldMatch", *false*);
>> query.set("hl.maxAnalyzedChars", -1);
>>
>> query.addSortField(/DATE_FIELD/, SolrQuery.ORDER./asc/);
>> query.setFacetLimit(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>> 10000));
>> query.setRows(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/,
>> 10000));
>> query.setIncludeScore(*true*);
>> QueryResponse rsp = server.query(query);
>> SolrDocumentList docs = rsp.getResults();
>>
>> --
>> Bruno Morelli Vargas      Mail: brunomv@gmail.com <mailto:
>> brunomv@gmail.com>
>> Msn: brunom_@hotmail.com <ma...@hotmail.com>
>> Icq: 165055101
>> Skype: morellibmv
>>
>>
>
>
>


-- 
Bruno Morelli Vargas
Mail: brunomv@gmail.com
Msn: brunom_@hotmail.com
Icq: 165055101
Skype: morellibmv

Re: SolrJ: Highlighting not Working

Posted by Mark Miller <ma...@gmail.com>.
Why do you have:
query.set("hl.maxAnalyzedChars", -1);

Have you tried using the default? Unless -1 is an undoc'd feature, this 
means you wouldnt get anything back! This should normally be a fairly 
hefty value and defaults to 51200, according to the wiki.

And why:
query.set("hl.fragsize", 1);

That means a fragment could only be 1 char - again, I'd try the default 
(take out the param), and adjust from there.
(wiki says the default is 100).

Let us know how it goes.

-- 
- Mark

http://www.lucidimagination.com



Bruno wrote:
> Hi guys.
>  
> I new at using highlighting, so probably I'm making some stupid 
> mistake, however I'm not founding anything wrong.
>  
> I use highlighting from a query withing a EmbeddedSolrServer, and 
> within the query I've set parameters necessary for enabling 
> highlighting. Attached, follows my schema and solrconfig.xml , and 
> down below follows the Java code. Content from the SolrDocumentList is 
> not highlighted.
>  
>
> EmbeddedSolrServer server = SolrServerManager./getServerEv/();
> String queryString = filter;
> SolrQuery query =
>
> *new* SolrQuery();
>
> query.setQuery(queryString);
> query.setHighlight(*true*);
> query.addHighlightField(/LOG_FIELD/);
> query.setHighlightSimplePost("<i>");
> query.setHighlightSimplePre("</i>");
> query.set("hl.usePhraseHighlighter", *true*);
> query.set("hl.highlightMultiTerm", *true*);
> query.set("hl.snippets", 100);
> query.set("hl.fragsize", 1);
> query.set("hl.mergeContiguous", *false*);
> query.set("hl.requireFieldMatch", *false*);
> query.set("hl.maxAnalyzedChars", -1);
>
> query.addSortField(/DATE_FIELD/, SolrQuery.ORDER./asc/);
> query.setFacetLimit(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/, 
> 10000));
> query.setRows(LogUtilProperties./getInstance/().getProperty(LogUtilProperties./LOGEVENT_SEARCH_RESULT_SIZE/, 
> 10000));
> query.setIncludeScore(*true*);
> QueryResponse rsp = server.query(query);
> SolrDocumentList docs = rsp.getResults();
>
> -- 
> Bruno Morelli Vargas      
> Mail: brunomv@gmail.com <ma...@gmail.com>
> Msn: brunom_@hotmail.com <ma...@hotmail.com>
> Icq: 165055101
> Skype: morellibmv
>