If my search keyword is 'test,' then my document is 'testtesttest.' How can I get the result to show that the number of occurrences is 3 in Solr?"

Unfortunately, the result I am getting shows a term frequency of 0 in Solr when I use the query q= test with the term function termfreq(section_title_t,test').

Please help. Thank you

  • have you tried writing your query like this q=*test* ?
    – Richard Seal
    Aug 7, 2023 at 18:36
  • Hello Alexng, did you find the solution to this ? We are in a same situation, let us know, if you found a way around.
    – D J
    Nov 14, 2023 at 9:24

1 Answer 1


In order to show the result of termfreq() in the solr dashboard as a separate field, you can use the fl= syntax as specified here: https://solr.apache.org/guide/8_3/function-queries.html

You can use the controls available in the SOLR dashboard to generate the URL for you.


First of all you need to add a standard query. Look for the box on the dashboard that has the q above and add something similar to:


Fields to return

Look for the box with fl and add something similar to below:

_uniqueid, termfreq(section_title,'test')

Note I added a uniqueid to differentiate, but you would most likely change to title field or something.


This might not be strictly be necessary in your situation, but if you are using a broader search query, then you need to ensure the results with higher matches are displayed. In this situation, look for the sort box and add something similar to:

termfreq(section_title,'test') desc

Execute Query

Now when you hit the Execute Query button, it will generate the correct URL with query specified. Yours should look something like this:


Working Example:

Please see screenshot below demonstrating this working as per above.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.