Вопрос

I am using solr, and so far everything is going great. When I do a search, I want to get back how many times the search 'term' was per document, along with the document itself. I have found alot of information but after going trough it I still don't understand how I can do this. Is it that extreme hard ?

Can anyone help me out?

Altough I do get results, the fl field is always 0

http://localhost:8983/solr/collection1/select?q=text:*mySearchTerm*&fl=*,fl:termfreq(text,*mySearchTerm*)
Это было полезно?

Решение

Ok, I found out that termfreq doesn't work for MultiValues fields. So I used a copy field and added termVectors="true" termPositions="true" termOffsets="true". Now it works

Другие советы

You might want to check out http://wiki.apache.org/solr/LukeRequestHandler - You should see the tag "numTerms" in the xml returned for you to use based on each field where required too.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top