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:
install solr
cd install dir:
cd /usr/local/cellar/solr/5.5.0
- start solr existing example "techproducts"
bin/solr -e techproducts
- index example pdfs
bin/post -c techproducts ~/desktop/some_pdfs/
go url localhost:8983, select core "techproducts" in left menu
enter search term in query field (replace *:* query string)
check "hl" field
enter field name in field "hl.fl" (for instance: "content")
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
Post a Comment