Solr highlights returns empty value

913 views
Skip to first unread message

Hari

unread,
Feb 14, 2014, 8:34:55 AM2/14/14
to sol...@googlegroups.com

IM using SolrNet (Version: 0.4.0.2002)to Query and my class is My class is:

public class SolrSimpleArticle
{
    [SolrUniqueKey("articleid")]
    public string ArticleId { get; set; }
    [SolrField("bodytext")]
    public string BodyText { get; set; }
}

My problem is that I can't make highlights to work. My code for highlightning:

    var results = solr.Query(iql, new QueryOptions
            {
                Start = start,
                Rows = 20,
                Highlight = new HighlightingParameters
                {
                    Fields = new[] { "bodytext" },
                    AfterTerm = highlight,
                    Snippets = 20,
                    MaxAnalyzedChars = 100000,
                }
            });

The returned results is as follows:

highlightedtext: Object
e410a0ac: Array[1]
    0: Object
    Key: "bodytext"
    Value: Array[0]
    __proto__: Object
    length: 1
    __proto__: Array[0]
e410b729: Array[1]
    0: Object
    Key: "bodytext"
    Value: Array[0]
    length: 0
    __proto__: Array[0]
    __proto__: Object
    length: 1
    __proto__: Array[0]

I need to know how i can get the highlighted snippet for each result and why there is no elements in the value array?Am I doing something wrong here?

I tried the defaults mentioned inhttps://github.com/mausch/SolrNet/blob/master/Documentation/Highlighting.md Same response though.

Mauricio Scheffer

unread,
Feb 16, 2014, 9:34:59 PM2/16/14
to sol...@googlegroups.com
I just checked the Highlighting tests against Solr 4.6.1, they work ok.

Double-check your config and data.



--
Mauricio


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

Hari

unread,
Mar 20, 2014, 8:55:51 AM3/20/14
to sol...@googlegroups.com
I have rechecked my config and my data.While i query solr directly, I do get highlighting correctly as a separate object after my response.  


However solrnet returns with an empty response object against bodytext field, the following is true against all other fields too.


Mauricio Scheffer

unread,
Mar 25, 2014, 4:34:57 PM3/25/14
to sol...@googlegroups.com
Can you post the result as XML, as returned by Solr? (as text, not an image, so I can copy it and write a test for it).

Hari

unread,
Mar 31, 2014, 11:51:10 AM3/31/14
to sol...@googlegroups.com
Hi, i have attached the xml version of the response in the forms of (10results,25results,50results ). Let me know if you need more info.


On Friday, February 14, 2014 2:34:55 PM UTC+1, Hari wrote:
select10.xml
select25.xml
select50.xml

Mauricio Scheffer

unread,
Apr 2, 2014, 2:45:48 PM4/2/14
to sol...@googlegroups.com


--
Mauricio


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.

Hari

unread,
Apr 29, 2014, 8:58:35 AM4/29/14
to sol...@googlegroups.com


On Friday, February 14, 2014 2:34:55 PM UTC+1, Hari wrote:

Hi Mauricio, Thanks for a quick fix, 

There a still two small issue remaining with regard to highlights,

1)       Solr highlights returns empty value when used with multiple fields

var results = solr.Query(iql, new QueryOptions

                {

                    Start = start,

                    Rows = 20,

                    Highlight = new HighlightingParameters

                    {

                        Fields = new[] { "bodytext", "allheadings" },

                        BeforeTerm = "<highlight>",

                        AfterTerm = "</highlight>"

 

                    },

 

                });

 

On checking with the logging connection, I find the parameters as follows’

 

GETting: q=hund, start=0, rows=20, hl=true, hl.fl=bodytext,allheadings, hl.simple.pre=<highlight>, hl.simple.post=</highlight> from/select

 

Correct me if im wrong, I guess separate highlights should be issued for each field?  Eg(hl.fl=bodytext hl.fl=allheadings)

 

2)   Solr highlights does not include a BeforeTerm = "<highlight>",AfterTerm = "</highlight>" value when used without defining fields to be highlighted, The idea here is to return all the fields with highlights. On inspection, I do find the highlights wrapped with "<em>","</em>" tags.

 

                var results = solr.Query(iql, new QueryOptions

                {

                    Start = start,

                    Rows = 20,

                    Highlight = new HighlightingParameters

                    {

                        BeforeTerm = "<highlight>",

                        AfterTerm = "</highlight>"

 

                    },

 

                });

 

 

On checking with the logging connection, I find the parameters as follows’, which misses a BeforeTerm = "<highlight>",AfterTerm = "</highlight>"

 

GETting/POSTing: q=hund, start=0, rows=20, hl=true from/select

  

Mauricio Scheffer

unread,
Apr 29, 2014, 2:15:40 PM4/29/14
to sol...@googlegroups.com


--
Mauricio


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
Reply all
Reply to author
Forward
0 new messages