0

All:

Right now, I am using SOLR highlight feature, but one thing I want to ask is:

Suppose I want to search keyword fund and value:

fund AND value

And the return highlight part is like:

"highlighting": {
    "blk_0019": {
      "content": [
        "philosophy of the <em>fund</em> – <em>value</em> and turning point. \n \n MUSA was an orphaned"
      ]
    },
    "blk_0006": {
      "content": [
        "Global Equities <em>Fund</em> Ltd. \n \n CONFIDENTIAL enclosed"
      ]
    }
}

The problem is I am sure blk_0019 and blk_0006 have both fund and value(obviously I use fund AND report), because the I set hl.fragsize=100, if the fund and value located not close enough in one document, they can not be shown both in same snippet. In blk_0019, solr highlights both fund and value, but in blk_0006, only fund shown.

How can I show both matched in single snippet and just ignore text between them as ..... like in Google

Also some small questions are:

[1] How to specify to search capitalized only word like Hello HELLO in Solr?

[2] How to search All-capital AND(All-capital "AND" will be consider as logical operator)

Thanks

Community
  • 1
  • 1
Kuan
  • 11,149
  • 23
  • 93
  • 201

1 Answers1

1

It depends on the highlighter you are using. For the Standard Highlighter you can set hl.snippets=5 for instance (default is 1). Then you'll get 5 snippets/fragments (at most), each with a maximum length of hl.fragsize.

They're returned as multiple values, so you'll need to join them yourself (using "..." for instance).

Simon
  • 857
  • 5
  • 14
  • Thanks for help. There is one question I am wondering: How can I arrange the priority of highlight results? Suppose I want to search: +Fund OR (value USA), it seems +Fund is a very important keyword and I definitively want to show its match in highlight result, but if the matched location in the document is beyond hl.snippets, it may not shown in the results, HOW CAN I configure to make sure Fund match result can always in the result? – Kuan Jan 09 '15 at 17:05
  • Good question. Maybe you should have a look at https://cwiki.apache.org/confluence/display/solr/Postings+Highlighter. It focusses on good summarizes by scoring the "passages" (as the fragements are called in this context). But be warned, it works completely differently. – Simon Jan 09 '15 at 17:15
  • Thanks, I study on that. Could you help me with another question about solr query syntax? http://stackoverflow.com/questions/27865771/beginner-about-solr-boolean-operation-like-combination-of-and-or – Kuan Jan 09 '15 at 17:17
  • Could you tell me where in your answer did you explain the solution to question [2]How to search All-capital AND(All-capital "AND" will be consider as logical operator) – Kuan Jan 09 '15 at 17:34
  • Boolean operators can be escaped in Solr using "\", see http://stackoverflow.com/questions/5890401 – Simon Jan 12 '15 at 09:09