2
votes

I am migrating a web site from an old version of solr (1.4.1) to the current release version (5.2.1) on a different machine and noticing some differences.

In the old version, I could get highlighting with a url like this:

http://localhost:8983/solr/select?indent=on&q=text:software/&start=0&rows=10&fl=id,score,title&wt=json&hl=on&hl.fragsize=200

In the new version, one thing that's different is I need to specify a collection. Another difference is that the new version gives an error if I put text: in front of the value of q.

So, taking into account those differences, I end up with a URL like this:

http://localhost:8983/solr/default/select?indent=on&q=software/&start=0&rows=10&fl=id,score,title&wt=json&hl=on&hl.snippets=1&hl.fl=%2a&hl.fragsize=200

That second URL does not give me highlighting fragments/snippets. That is to say, where the old URL would give something like this:

"highlighting":{
  "document0_id":{"text":["The <em>software</em> is awesome"]}}

The new URL gives something like this:

"highlighting":{
  "document0_id":{}}

What do I need to do to get highlighting fragments returned in solr 5.2.1?

[edited]

In addition, I tried selecting a single document by its id on both machines. On the old machine, a url like

http://localhost:8983/solr/select?wt=json&indent=true&q=id:thedocumentid

returns some JSON that includes a text field containing the full searchable text of the original HTML document. On the new machine a similar url (but one that includes the collection):

http://localhost:8983/solr/default/select?wt=json&indent=true&q=id:thedocumentid

...returns similar JSON that does not include the text field.

I note that searching returns the correct results; the problem is that on the new machine, the results do not include the highlighting fragments. So it seems like maybe the issue is that I need to specify that these documents have a text field when I index them; how do I do that?

2

2 Answers

1
votes

A colleague (not tempted by the bounty) noticed that my text field had stored="false" in my schema.xml and suggsted changing it to true. That did the trick.

0
votes
  1. In the first query you are specifically searching in the text field and in the second its not.

  2. And in the second you have mentioned hl.fl which means "Specifies a list of fields to highlight. Accepts a comma- or space-delimited list of fields for which Solr should generate highlighted snippets. If left blank, highlights the defaultSearchField"

Try again by making the changes...

http://localhost:8983/solr/default/select?q=text:software&start=0&rows=10&fl=id,score,title&wt=json&hl=on&hl.fragsize=200