Content highlighting in solr query results -


in standard install of solr full working example enables highlighting in search results (named "techproducts"). here how make work:

  1. install solr

  2. cd install dir:

cd /usr/local/cellar/solr/5.5.0

  1. start solr existing example "techproducts"

bin/solr -e techproducts

  1. index example pdfs

bin/post -c techproducts ~/desktop/some_pdfs/

  1. go url localhost:8983, select core "techproducts" in left menu

  2. enter search term in query field (replace *:* query string)

  3. check "hl" field

  4. enter field name in field "hl.fl" (for instance: "content")

  5. hit "execute query" button

now you'll see @ bottom of result page context (or snippets) search keyword:

"highlighting": { "/users/ugur/desktop/some_pdfs/jquery pocket reference.pdf": { "content": [ " jquery pocket" ] }, "/users/ugur/desktop/some_pdfs/jquery ui.pdf": { "content": [ " \n \n \n\n \n \n \n \n jquery" ] }, "/users/ugur/desktop/some_pdfs/jquery recipes.pdf": { "content": [ " - jquery recipes \n \n \n >" ] } }

i had these 2 files see how make highlighting work me:

  • ./solr/5.5.0/example/techproducts/solr/techproducts/conf/managed-schema

and

  • ./solr/5.5.0/example/techproducts/solr/techproducts/conf/solrconfig.xml

old question below

i can't seem make solr return context in query results (highlighting), no matter do.

here steps followed:

brew install solr  # installed via brew cd /usr/local/cellar/solr  # cd'd install path bin/solr start  # started solr // works; can call url localhost:8983 bin/solr stop -p 8983 # stopped again bin/solr -e dih  # started solar provided example  bin/post -c tika ~/desktop/the-effective-engineer-sample.pdf  # posted example pdf core "tika" 

now if go url localhost:8983, select example-core "tika" , fire query, works, , document have indexed. if turn on highlihting (hl = checked), no context in highlighting section

"highlighting": {     "~/desktop/the-effective-engineer-sample.pdf": {}   } 

do need define schema.xml? created 1 like

<schema name='simple' version='1.1'>     <types>         <fieldtype name='string' class='solr.strfield' />     </types>     <fields>         <dynamicfield name='*' type='string' multivalued='true' indexed='true' stored='true'/>         <copyfield source='*' dest='fulltext'/>         <field name='fulltext' type='string' multivalued='true'/>     </fields>     <defaultsearchfield>fulltext</defaultsearchfield>     <solrqueryparser defaultoperator='or'/> </schema> 

still don't result in highlighting section.

can point me simple working tutorial? thanks!


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -